Word

Word class description

Namespace: Nlp4Net.NlpLib Assembly: NlpLib.dll

public class Word : IUserData, ICloneable


Word provides part of speech and optional syntax information about a Lexeme. Syntax parser relies on this information to find syntax relations between words in an utterance.

If word is a fragment of a compound lexeme like "hot dog" or "cannot", it contains information allowing to construct the whole compound from fragments.

You can associate your objects with a Word, using IUserData interface. IUserData.UserData can be a primary key in your dictionary, sound file or semantic information.

Typically you use Word.Text, Word.POS and Word.Tags properties.

Note: synchronizing Words with your dictionaries.

If you want to associate a word with your database, you can use Word.LCID + Word.Text + Word.POS + Word.Tags as a primary key. It is the independent [lexical + syntax] key identifying a word in any dictionary.

For better performance you can use a short key: [NlpLib file version] + Word.LCID + Word.Id to build a fast index of words used in your application. Word.Id is not guaranteed to be the same if the build number of NlpLib.dll is changed. If you replace NlpLib.dll with a different file version, you need to rebuild the index.

To synchronize with your dictionary you can enumerate words from your dictionary and parse them using NLParser.Text<Lexeme>(string szMyWord)




Constructors Description
Nlp4Net method Word() creates an empty Word
Nlp4Net method Word(Word other) copy constructor
Nlp4Net method Word(string text) initializes Word with a string
Nlp4Net method Word(int LCID, string text) initializes Word with LCID and a string



Methods Description
Nlp4Net methodobject ICloneable.Clone() creates a copy of Word
Nlp4Net method bool HasAll(params SyntaxTag[] tags) Returns true if Word contains all syntax tags.
Nlp4Net method bool HasAny(params SyntaxTag[] tags) Returns true if Word contains any syntax tag.



Properties Description
Nlp4Net property long Id Unique word identifier
Nlp4Net property bool IsFragment Returns true if Flags property is non-zero
Nlp4Net propertyobject IUserData.UserData Your arbitrary object
Nlp4Net property FragmentFlags Flags Fragment flags (for fragments only)
Nlp4Net property int FragmentNumber Sequential fragment number (for fragments only)
Nlp4Net property int LCID LCID
Nlp4Net property Lexeme Lexeme owning Lexeme
Nlp4Net property PartOfSpeech POS part of speech. See PartOfSpeech enumeration.
Nlp4Net property SyntaxTag[] Tags additional syntax information like transitivity, time, plural/singular, person and so on.
Nlp4Net propertystring Text string of characters comprising the Word