Пример #1
0
        /**
         * Generates a single classification instance of the NER problem for the given word of the given sentence. If the
         * word has not been labeled with NER tag yet, the method returns null.
         * @param sentence Input sentence.
         * @param wordIndex The index of the word in the sentence.
         * @return Classification instance.
         */
        public override Instance GenerateInstanceFromSentence(Sentence sentence, int wordIndex)
        {
            var word = (AnnotatedWord)sentence.GetWord(wordIndex);

            var classLabel = NamedEntityTypeStatic.GetNamedEntityType(word.GetNamedEntityType());

            if (classLabel == null)
            {
                return(null);
            }

            var current = new Instance(classLabel);

            AddAttributes(current, sentence, wordIndex);
            return(current);
        }
 public void TestNamedEntityType()
 {
     Assert.AreEqual(NamedEntityTypeStatic.GetNamedEntityType("person"), NamedEntityType.PERSON);
     Assert.AreEqual(NamedEntityTypeStatic.GetNamedEntityType("Time"), NamedEntityType.TIME);
     Assert.AreEqual(NamedEntityTypeStatic.GetNamedEntityType("location"), NamedEntityType.LOCATION);
 }
Пример #3
0
 public new string GetLayerValue()
 {
     return(NamedEntityTypeStatic.GetNamedEntityType(_namedEntity));
 }
Пример #4
0
 public new void SetLayerValue(string layerValue)
 {
     this.layerValue = layerValue;
     _namedEntity    = NamedEntityTypeStatic.GetNamedEntityType(layerValue);
 }