/// <summary> /// Returns transition to specified character (if exists) /// </summary> /// <param name="c">Character</param> /// <returns>Returns TreeNode or null</returns> public TreeNode GetTransition(NerOutputType nerOutputType) { var node = default(TreeNode); if (_TransDictionary.TryGetValue(nerOutputType, out node)) { return(node); } return(null); }
/// <summary> /// Returns transition to specified character (if exists) /// </summary> /// <param name="nerOutputType">NerOutputType</param> /// <returns>Returns TreeNode or null</returns> public TreeNode GetTransition(NerOutputType nerOutputType) { TreeNode node; if ((_TransDict != null) && _TransDict.TryGetValue(nerOutputType, out node)) { return(node); } return(null); }
public static BuildModelNerInputType ToBuildModelNerInputTypeI(this NerOutputType nerOutputType) { switch (nerOutputType) { case NerOutputType.NAME: return(BuildModelNerInputType.I_NAME); case NerOutputType.ORG: return(BuildModelNerInputType.I_ORG); case NerOutputType.GEO: return(BuildModelNerInputType.I_GEO); case NerOutputType.ENTR: return(BuildModelNerInputType.I_ENTR); case NerOutputType.PROD: return(BuildModelNerInputType.I_PROD); default: return(BuildModelNerInputType.O); } }
public static char ToCrfChar(this NerOutputType nerOutputType) { switch (nerOutputType) { case NerOutputType.NAME: return('N'); case NerOutputType.ORG: return('J'); case NerOutputType.GEO: return('G'); case NerOutputType.ENTR: return('E'); case NerOutputType.PROD: return('P'); default: return('O'); } }
public static string ToText(this NerOutputType nerOutputType) { switch (nerOutputType) { case NerOutputType.NAME: return("NAME"); case NerOutputType.ORG: return("ORG"); case NerOutputType.GEO: return("GEO"); case NerOutputType.ENTR: return("ENTR"); case NerOutputType.PROD: return("PROD"); default: return("O"); } }
internal static BuildModelNerInputType ToBuildModelNerInputTypeB(this NerOutputType nerOutputType) { switch (nerOutputType) { case NerOutputType.NAME: return(BuildModelNerInputType.B_NAME); case NerOutputType.ORG: return(BuildModelNerInputType.B_ORG); case NerOutputType.GEO: return(BuildModelNerInputType.B_GEO); case NerOutputType.ENTR: return(BuildModelNerInputType.B_ENTR); case NerOutputType.PROD: return(BuildModelNerInputType.B_PROD); default: //case NerOutputType.O: return(BuildModelNerInputType.O); } }
public List <buildmodel_word_t> run4ModelBuilder( string partOfSentText, bool isLastPartOfSentText, NerOutputType nerOutputType, bool prevPartOfSentTextSameNerOutputType) { _BuildModelWords.Clear(); if (prevPartOfSentTextSameNerOutputType) { _BuildModelNerInputTypeI = nerOutputType.ToBuildModelNerInputTypeI(); _BuildModelNerInputTypeB = _BuildModelNerInputTypeI; } else { _BuildModelNerInputTypeI = nerOutputType.ToBuildModelNerInputTypeI(); _BuildModelNerInputTypeB = nerOutputType.ToBuildModelNerInputTypeB(); } _ProcessSentCallback = ProcessSentCallbackModelBuilder; fixed(char *_base = partOfSentText) fixed(CharType * ctm = xlat.CHARTYPE_MAP) fixed(NERCharType * nctm = NER_CHARTYPE_MAP) { _BASE = _base; _CTM = ctm; _NCTM = nctm; _NotSkipNonLetterAndNonDigitToTheEnd = !isLastPartOfSentText; var urls = _UrlDetector.AllocateUrls(partOfSentText); _BuildModelSent.Set4ModelBuilder(0, partOfSentText.Length, (0 < urls.Count) ? urls : null); ProcessSentSplitterCallback(_BuildModelSent); _NotSkipNonLetterAndNonDigitToTheEnd = false; } _ProcessSentCallback = null; return(_BuildModelWords); }
public List <Buildmodel_word_t> Run4ModelBuilder( string partOfSentText, bool isLastPartOfSentText, NerOutputType nerOutputType, bool prevPartOfSentTextSameNerOutputType) { _buildModelWords.Clear(); if (prevPartOfSentTextSameNerOutputType) { _buildModelNerInputTypeI = nerOutputType.ToBuildModelNerInputTypeI(); _buildModelNerInputTypeB = _buildModelNerInputTypeI; } else { _buildModelNerInputTypeI = nerOutputType.ToBuildModelNerInputTypeI(); _buildModelNerInputTypeB = nerOutputType.ToBuildModelNerInputTypeB(); } _outerProcessSentCallbackDelegate = ProcessSentCallbackModelBuilder; fixed(char *_base = partOfSentText) { _BASE = _base; _dontSkipNonLetterAndNonDigitToTheEnd = !isLastPartOfSentText; var urls = _urlDetector.AllocateUrls(partOfSentText); _buildModelSentence.Set4ModelBuilder(0, partOfSentText.Length, (0 < urls.Count) ? urls : null); SentSplitterProcessSentCallback(_buildModelSentence); _dontSkipNonLetterAndNonDigitToTheEnd = false; } _outerProcessSentCallbackDelegate = null; return(_buildModelWords); }
public SearchResult(int startIndex, int length, NerOutputType nerOutputType) { StartIndex = startIndex; Length = length; NerOutputType = nerOutputType; }
public override string ToString() { return(((Parent != null) ? ('\'' + NerOutputType.ToString() + '\'') : "ROOT") + ", transitions(descendants): " + ((_TransDict != null) ? _TransDict.Count : 0) + ", ngrams: " + ((_Ngrams != null) ? _Ngrams.Count : 0) ); }
/// <summary> /// Returns true if node contains transition to specified character /// </summary> /// <param name="nerOutputType">NerOutputType</param> /// <returns>True if transition exists</returns> public bool ContainsTransition(NerOutputType nerOutputType) { return((_TransDict != null) && _TransDict.ContainsKey(nerOutputType)); }
public TreeNode(TreeNode parent, NerOutputType nerOutputType) { NerOutputType = nerOutputType; Parent = parent; }
public ngram_t(NerOutputType[] nerOutputTypes, NerOutputType resultNerOutputType) { NerOutputTypes = nerOutputTypes; ResultNerOutputType = resultNerOutputType; }
/// <summary> /// Returns true if node contains transition to specified character /// </summary> /// <param name="c">Character</param> /// <returns>True if transition exists</returns> public bool ContainsTransition(NerOutputType nerOutputType) { return(_TransDictionary.ContainsKey(nerOutputType)); }