onenlpCookbook
onenlp cookbook
Short recipes for common OneNLP tasks, each with complete code you can copy.
Text processing
Detect the language of text in C#Identify a string’s language locally with the model included in OneNLP.Named entity recognition in C#Find names of people and places with OneNLP’s packaged English model.Tokenize text in C#Split prose into words and punctuation, not language-model token IDs.Split text into sentences in C#Split sentences with Unicode rules and language-specific abbreviation data.Lemmatize text in C#Get dictionary forms such as “run” for “running” with the English model.
Analyze text
Part-of-speech tagging in C#Label English words as nouns, verbs and other parts of speech.Dependency parsing in C#Link words to their grammatical heads to find subjects and modifiers.Generate sentence embeddings in C#Turn sentences into numeric vectors for similarity and search, locally.Extract dates and numbers from text in C#Extract dates and written numbers; resolve “tomorrow” against a reference date.Train a text classifier in C#Train a classifier to label text, using two tiny demonstration examples.