コード例 #1
0
 public NotenizerDependency(TypedDependency typedDependency)
 {
     _dependent = new NotenizerWord(typedDependency.dep());
     _governor = new NotenizerWord(typedDependency.gov());
     _relation = new NotenizerRelation(typedDependency.reln());
     _originalDependency = typedDependency;
 }
コード例 #2
0
ファイル: NoteParticle.cs プロジェクト: nemcek/notenizer
 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;
 }
コード例 #3
0
ファイル: NoteParticle.cs プロジェクト: nemcek/notenizer
 public NoteParticle(NotenizerDependency dependency)
 {
     _tokenType = dependency.TokenType;
     _noteDependency = dependency.Clone();
     _noteWord = dependency.CorrespondingWord;
     //_noteWordValue = MakeWordConsiderRelation(_noteWord, _noteDependency.Relation);
     _noteWordValue = _noteWord.Word;
 }
コード例 #4
0
ファイル: NoteParticle.cs プロジェクト: nemcek/notenizer
        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; ;
        }
コード例 #5
0
 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;
 }
コード例 #6
0
 public static bool SamePartOfSpeechTag(NotenizerWord firstW, NotenizerWord secondW)
 {
     return firstW.POS.Tag == secondW.POS.Tag;
 }
コード例 #7
0
 public static bool SameNER(NotenizerWord firstW, NotenizerWord secondW)
 {
     return firstW.NamedEntity.Value == secondW.NamedEntity.Value;
 }
コード例 #8
0
 public static bool SameLemma(NotenizerWord firstW, NotenizerWord secondW)
 {
     return firstW.Lemma == secondW.Lemma;
 }
コード例 #9
0
 public static bool SameIndex(NotenizerWord firstW, NotenizerWord secondW)
 {
     return firstW.Index == secondW.Index;
 }
コード例 #10
0
 public static double CalculateClosenessWords(NotenizerWord firstW, NotenizerWord secondW, double comparisonValue, int count)
 {
     return CalculateCloseness(firstW.Index, secondW.Index, comparisonValue, count);
 }
コード例 #11
0
ファイル: DocumentParser.cs プロジェクト: nemcek/notenizer
        /// <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;
        }
コード例 #12
0
ファイル: NoteParticle.cs プロジェクト: nemcek/notenizer
 public NoteParticle(String noteWordValue, NotenizerWord noteWord, NotenizerDependency noteDependency)
 {
     _noteWordValue = noteWordValue;
     _noteWord = noteWord;
     _noteDependency = noteDependency.Clone();
 }
コード例 #13
0
ファイル: NoteParticle.cs プロジェクト: nemcek/notenizer
        /// <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;
        }