Skip to content

System.NullReferenceException during tokenization #1

@sdg002

Description

@sdg002

Hi All,
I am trying to get some very basic tokenization to work. I think I am not using the API properly because the method Tokenize is throwing System.NullReferenceException. Any suggestions?

My code

using CH = global::CherubNLP.Tokenize;

public string[] MyTokenize(string sentence)
{
           var options = new CH.TokenizationOptions
            {
                
            };
            var tokenizer = new CH.TokenizerFactory(
                                    options, 
                                    global::CherubNLP.SupportedLanguage.English);
            var tokens = tokenizer.Tokenize(sentence);
            string[] results = tokens.
                                    Where(tk=>tk.IsAlpha==true).
                                    Select(tk => tk.Text).ToArray();
            return results;
}
 

Thank you,
Sau

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions