/// создание морфотипа из строки private MorphoTypePair?CreateMorphoTypePair(string line) { var m = MORPHOTYPE_PREFIX_REGEXP.Match(line); if (m == null || m.Groups.Count < 3) { return(null); } string prefix = m.Groups[1].Value; string pos = m.Groups[2].Value; string name = line.Substring(prefix.Length); var partOfSpeech = default(PartOfSpeechEnum); if (Enum.TryParse(pos, true, out partOfSpeech)) { var morphoType = new MorphoType(_PartOfSpeechList.GetPartOfSpeech(partOfSpeech)); var morphoTypePair = new MorphoTypePair() { Name = name, MorphoType = morphoType, }; return(morphoTypePair); } else { _ModelLoadingErrorCallback("Unknown part-of-speech: '" + pos + '\'', line); } return(null); }
/// создание морфотипа из строки private MorphoType_pair_t?CreateMorphoTypePair(string line) { var m = MORPHOTYPE_PREFIX_REGEXP.Match(line); if (m == null || m.Groups.Count < 3) { return(null); } string prefix = m.Groups[1].Value; string pos = m.Groups[2].Value; string name = line.Substring(prefix.Length); var partOfSpeech = default(PartOfSpeechEnum); if (Enum.TryParse(pos, true, out partOfSpeech)) { var morphoType = new MorphoType(_PartOfSpeechList.GetPartOfSpeech(partOfSpeech)); var morphoTypePair = new MorphoType_pair_t() { Name = name, MorphoType = morphoType, }; return(morphoTypePair); } else { _ModelLoadingErrorCallback("Unknown part-of-speech: '" + pos + '\'', line); } return(null); #region commented //int index = MorphoTypePrefixRegExp.indexIn( str ); //if (index != 0) // return (null); //string prefix = MorphoTypePrefixRegExp.cap(1); //string partOfSpeech = MorphoTypePrefixRegExp.cap(2); //string name = str.Substring( prefix.Length ); //return (new CMorphoType( name, CPartOfSpeech.Create( partOfSpeech ) )); #endregion }