public NotenizerDependency(TypedDependency typedDependency) { _dependent = new NotenizerWord(typedDependency.dep()); _governor = new NotenizerWord(typedDependency.gov()); _relation = new NotenizerRelation(typedDependency.reln()); _originalDependency = typedDependency; }
public NoteParticle(String noteWordValue, NotenizerDependency dependency, TokenType tokenType) { _tokenType = tokenType; _noteDependency = dependency.Clone(); _noteDependency.TokenType = tokenType; _noteWordValue = noteWordValue; _noteWord = tokenType == TokenType.Dependent ? dependency.Dependent : dependency.Governor; }
public NoteParticle(NotenizerDependency dependency) { _tokenType = dependency.TokenType; _noteDependency = dependency.Clone(); _noteWord = dependency.CorrespondingWord; //_noteWordValue = MakeWordConsiderRelation(_noteWord, _noteDependency.Relation); _noteWordValue = _noteWord.Word; }
public NoteParticle(NotenizerDependency dependency, TokenType tokenType, bool considerRelationInWordValueMaking = false) { if (tokenType == TokenType.Unidentified) throw new Exception("Can't make NoteParticle from token of type " + tokenType.ToString()); _tokenType = tokenType; _noteDependency = dependency.Clone(); _noteDependency.TokenType = tokenType; _noteWord = _tokenType == TokenType.Dependent ? dependency.Dependent : dependency.Governor; _noteWordValue = considerRelationInWordValueMaking ? MakeWordConsiderRelation(_noteWord, _noteDependency.Relation) : _noteWord.Word; ; }
public NotenizerDependency( NotenizerWord governor, NotenizerWord dependent, NotenizerRelation relation, int position, ComparisonType comparisonType, TokenType tokenType) { _governor = governor; _dependent = dependent; _relation = relation; _position = position; _comparisonType = comparisonType; _tokenType = tokenType; }
public static bool SamePartOfSpeechTag(NotenizerWord firstW, NotenizerWord secondW) { return firstW.POS.Tag == secondW.POS.Tag; }
public static bool SameNER(NotenizerWord firstW, NotenizerWord secondW) { return firstW.NamedEntity.Value == secondW.NamedEntity.Value; }
public static bool SameLemma(NotenizerWord firstW, NotenizerWord secondW) { return firstW.Lemma == secondW.Lemma; }
public static bool SameIndex(NotenizerWord firstW, NotenizerWord secondW) { return firstW.Index == secondW.Index; }
public static double CalculateClosenessWords(NotenizerWord firstW, NotenizerWord secondW, double comparisonValue, int count) { return CalculateCloseness(firstW.Index, secondW.Index, comparisonValue, count); }
/// <summary> /// Create dependencies from deocument. /// </summary> /// <param name="dbEntry"></param> /// <param name="noteFieldName"></param> /// <returns></returns> private static NotenizerDependencies ParseDependencies(BsonDocument dbEntry, String noteFieldName) { int position; TokenType tokenType; NotenizerWord governor; NotenizerWord dependent; BsonDocument governorDoc; BsonDocument dependantDoc; NotenizerRelation relation; ComparisonType comparisonType; NotenizerDependency dependency; NotenizerDependencies dependencies = new NotenizerDependencies(); // foreach note dependency foreach (BsonDocument documentLoop in dbEntry[noteFieldName].AsBsonArray) { relation = new NotenizerRelation(documentLoop[DBConstants.RelationNameFieldName].AsString); // foreach dependency in array of dependencies with same relation name foreach (BsonDocument dependencyDocLoop in documentLoop[DBConstants.DependenciesFieldName].AsBsonArray) { governorDoc = dependencyDocLoop[DBConstants.GovernorFieldName].AsBsonDocument; dependantDoc = dependencyDocLoop[DBConstants.DependentFieldName].AsBsonDocument; position = dependencyDocLoop[DBConstants.PositionFieldName].AsInt32; comparisonType = dependencyDocLoop.GetValue(DBConstants.ComparisonTypeFieldName, ComparisonType.Unidentified).AsInt32.ToEnum<ComparisonType>(); tokenType = dependencyDocLoop.GetValue(DBConstants.TokenTypeFieldName, TokenType.Unidentified).AsInt32.ToEnum<TokenType>(); governor = new NotenizerWord( governorDoc[DBConstants.POSFieldName].AsString, governorDoc[DBConstants.IndexFieldName].AsInt32, governorDoc[DBConstants.LemmaFieldName].AsString, governorDoc[DBConstants.NERFieldName].AsString); dependent = new NotenizerWord( dependantDoc[DBConstants.POSFieldName].AsString, dependantDoc[DBConstants.IndexFieldName].AsInt32, dependantDoc[DBConstants.LemmaFieldName].AsString, dependantDoc[DBConstants.NERFieldName].AsString); dependency = new NotenizerDependency(governor, dependent, relation, position, comparisonType, tokenType); dependencies.Add(dependency); } } return dependencies; }
public NoteParticle(String noteWordValue, NotenizerWord noteWord, NotenizerDependency noteDependency) { _noteWordValue = noteWordValue; _noteWord = noteWord; _noteDependency = noteDependency.Clone(); }
/// <summary> /// Create word with considering special relations. /// </summary> /// <param name="noteWord"></param> /// <param name="relation"></param> /// <returns></returns> private String MakeWordConsiderRelation(NotenizerWord noteWord, NotenizerRelation relation) { String word = String.Empty; if (relation.ShortName == GrammaticalConstants.NominalModifier) word = relation.AdjustedSpecific + NotenizerConstants.WordDelimeter + noteWord.Word; else word = noteWord.Word; return word; }