public Structure(NotenizerDependencies dependencies, String id, DateTime createdAt, DateTime updatedAt) { _dependencies = dependencies; _id = id; _createdAt = createdAt; _updatedAt = updatedAt; }
public NotenizerRule() { _id = null; _dependencies = null; _createdAt = DateTime.Now; _updatedAt = DateTime.Now; }
public NotenizerRule(String id, NotenizerDependencies dependencies) { _id = id; _structure = new NotenizerStructure(dependencies); _dependencies = dependencies; _createdAt = DateTime.Now; _updatedAt = DateTime.Now; }
public NotenizerAndRule(NotenizerDependencies dependencies, int setsPosition, int sentenceEnd) : base(String.Empty, dependencies) { _setsPosition = setsPosition; _sentenceTerminator = sentenceEnd; }
/// <summary> /// Gets depeendencies from sentence. /// </summary> /// <param name="annotation"></param> /// <returns></returns> private NotenizerDependencies GetDepencencies(Annotation annotation) { Tree tree; NotenizerDependency dep; GrammaticalStructure gramStruct; NotenizerDependencies dependencies; NotenizerDependency nsubjComplement; TreebankLanguagePack treeBankLangPack; java.util.Collection typedDependencies; GrammaticalStructureFactory gramStructFact; tree = annotation.get(typeof(TreeCoreAnnotations.TreeAnnotation)) as Tree; treeBankLangPack = new PennTreebankLanguagePack(); gramStructFact = treeBankLangPack.grammaticalStructureFactory(); gramStruct = gramStructFact.newGrammaticalStructure(tree); typedDependencies = gramStruct.typedDependenciesCollapsed(); dependencies = new NotenizerDependencies(); foreach (TypedDependency typedDependencyLoop in (typedDependencies as java.util.ArrayList)) { dep = new NotenizerDependency(typedDependencyLoop); dependencies.Add(dep); if (dep.Relation.IsNominalSubject()) { nsubjComplement = new NotenizerDependency(typedDependencyLoop); nsubjComplement.TokenType = dep.TokenType == TokenType.Dependent ? TokenType.Governor : TokenType.Dependent; dependencies.Add(nsubjComplement); } } return dependencies; }
/// <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 NotenizerStructure(Structure structure) { this._structure = structure; this._dependencies = structure.Dependencies; this._compressedDependencies = new CompressedDependencies(this._dependencies); }
public NotenizerStructure(NotenizerDependencies dependencies) { _dependencies = dependencies; _compressedDependencies = new CompressedDependencies(dependencies); _structure = new Structure(dependencies, DateTime.Now, DateTime.Now); }
public NotenizerStructure() { _dependencies = new NotenizerDependencies(); _compressedDependencies = new CompressedDependencies(); _structure = new Structure(); }
public Structure() { _dependencies = new NotenizerDependencies(); }
/// <summary> /// Create labels from unused dependencies. /// </summary> /// <param name="depenencies"></param> /// <returns></returns> private List<NotenizerAdvancedLabel> CreateUnusedLables(NotenizerDependencies depenencies) { NotenizerDependency clonedDependency; List<NotenizerAdvancedLabel> labels = new List<NotenizerAdvancedLabel>(); foreach (NotenizerDependency originalSentenceDependencyLoop in depenencies) { clonedDependency = originalSentenceDependencyLoop.Clone(); if (!clonedDependency.Relation.IsNominalSubject()) clonedDependency.TokenType = TokenType.Dependent; labels.Add(new NotenizerAdvancedLabel(clonedDependency)); } return labels; }
/// <summary> /// Create labels from dependencies. /// </summary> /// <param name="dependencies"></param> /// <returns></returns> private List<NotenizerAdvancedLabel> CreateLabels(NotenizerDependencies dependencies) { List<NotenizerAdvancedLabel> labels = new List<NotenizerAdvancedLabel>(); foreach (NotenizerDependency noteDependency in dependencies) labels.Add(new NotenizerAdvancedLabel(noteDependency)); return labels; }