Last active
June 24, 2019 11:56
-
-
Save ayushoriginal/94f1357b3c456d7d3381229e0a2b6c0e to your computer and use it in GitHub Desktop.
token_lowercase_cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using NaturalLanguage; | |
private readonly hate_coreml hate_model = new hate_coreml(); // Initialize CoreML Model | |
NSValue[] tokens; | |
var tokenizer = new NLTokenizer(unit); | |
tokenizer.String = UserInput.Text; | |
var range = new NSRange(0, UserInput.Text.Length); | |
var k = tokenizer.GetTokens(range); // returns Foundation.NSValue[] | |
tokens = k; | |
tokens_str = new string[tokens.Length]; | |
for (int i = 0; i < tokens.Length; i++) | |
{ | |
NSRange rr = tokens[i].RangeValue; // Extract Range Value | |
string s = input_text.Substring((int)rr.Location, (int)rr.Length); | |
tokens_str[i] = s.ToLower(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment