Exemplo n.º 1
0
        /**
         * <summary>Given the parsed xml node which contains information about a word and related attributes including the
         * dependencies, the method constructs a {@link TurkishDependencyTreeBankWord} from it.</summary>
         * <param name="wordNode">Xml parsed node containing information about a word.</param>
         */
        public TurkishDependencyTreeBankWord(XmlNode wordNode)
        {
            int i;
            int toWord = 0, toIg = 0;

            _originalParses = new List <MorphologicalParse>();
            name            = wordNode.InnerText;
            var ig = wordNode.Attributes["IG"].Value;

            _parse = new MorphologicalParse(SplitIntoInflectionalGroups(ig));
            var relationName = wordNode.Attributes["REL"].Value;

            if (relationName != "[,( )]")
            {
                char[] delimiters    = { '[', '(', ')', ']', ',' };
                var    relationParts = relationName.Split(delimiters);
                var    index         = 0;
                for (i = 0; i < relationParts.Length; i++)
                {
                    if (relationParts[i].Length != 0)
                    {
                        index++;
                        switch (index)
                        {
                        case 1:
                            toWord = int.Parse(relationParts[i]);
                            break;

                        case 2:
                            toIg = int.Parse(relationParts[i]);
                            break;

                        case 3:
                            var dependencyType = relationParts[i];
                            _relation = new TurkishDependencyRelation(toWord - 1, toIg - 1, dependencyType);
                            break;
                        }
                    }
                }
            }

            for (i = 1; i <= 9; i++)
            {
                if (wordNode.Attributes["ORG_IG" + i] != null)
                {
                    ig = wordNode.Attributes["ORG_IG" + i].Value;
                    var groups             = SplitIntoInflectionalGroups(ig);
                    var morphologicalParse = new MorphologicalParse(groups);
                    _originalParses.Add(morphologicalParse);
                }
                else
                {
                    break;
                }
            }
        }
 public void Setup()
 {
     parse1 = new MorphologicalParse("bayan+NOUN+A3SG+PNON+NOM");
     parse2 = new MorphologicalParse("yaşa+VERB+POS^DB+ADJ+PRESPART");
     parse3 = new MorphologicalParse("serbest+ADJ");
     parse4 = new MorphologicalParse("et+VERB^DB+VERB+PASS^DB+VERB+ABLE+NEG+AOR+A3SG");
     parse5 = new MorphologicalParse("sür+VERB^DB+VERB+CAUS^DB+VERB+PASS+POS^DB+NOUN+INF2+A3SG+P3SG+NOM");
     parse6 = new MorphologicalParse("değiş+VERB^DB+VERB+CAUS^DB+VERB+PASS+POS^DB+VERB+ABLE+AOR^DB+ADJ+ZERO");
     parse7 = new MorphologicalParse(
         "iyi+ADJ^DB+VERB+BECOME^DB+VERB+CAUS^DB+VERB+PASS+POS^DB+VERB+ABLE^DB+NOUN+INF2+A3PL+P3PL+ABL");
     parse8 = new MorphologicalParse("değil+ADJ^DB+VERB+ZERO+PAST+A3SG");
     parse9 = new MorphologicalParse("hazır+ADJ^DB+VERB+ZERO+PAST+A3SG");
 }
 /**
  * <summary>Discrete attribute for a given word. Returns the last part of speech (main part of speech) of the word</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public MainPosAttribute(MorphologicalParse parse) : base(parse.GetPos())
 {
 }
Exemplo n.º 4
0
 /**
  * <summary>Binary attribute for a given word. If the last inflectional group of the word contains ACCUSATIVE tag,
  * the attribute will be "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public LastIGContainsTagAccusativeAttribute(MorphologicalParse parse) : base(parse, MorphologicalTag.ACCUSATIVE)
 {
 }
 /**
  * <summary>Binary attribute for a given word. If the last inflectional group of the word contains POSSESSIVE tag,
  * the attribute will be "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public LastIGContainsPossessiveAttribute(MorphologicalParse parse) : base(parse.LastIGContainsPossessive())
 {
 }
Exemplo n.º 6
0
 /**
  * <summary>Binary attribute for a given word. If the word is represents a number (if the morphological parse contains
  * tag REAL or CARDINAL), the attribute will have the value "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public IsNumberAttribute(MorphologicalParse parse) : base(parse.IsNumber())
 {
 }
Exemplo n.º 7
0
 /**
  * <summary>Binary attribute for a given word. If the last inflectional group of the word contains INSTRUMENTAL tag,
  * the attribute will be "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public LastIGContainsTagInstrumentalAttribute(MorphologicalParse parse) : base(parse,
                                                                                MorphologicalTag.INSTRUMENTAL)
 {
 }
Exemplo n.º 8
0
 /**
  * <summary>Binary attribute for a given word. If the last inflectional group of the word contains ABLATIVE tag,
  * the attribute will be "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public LastIGContainsTagAblativeAttribute(MorphologicalParse parse) : base(parse, MorphologicalTag.ABLATIVE)
 {
 }
 /**
  * <summary> Binary attribute for a given word. If the word is an auxiliary verb, the attribute will have
  * the value "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public IsAuxiliaryVerbAttribute(MorphologicalParse parse) : base(parse.IsAuxiliary() && parse.IsVerb())
 {
 }
Exemplo n.º 10
0
 /**
  * <summary>Binary attribute for a given word. If the word represents a date (if the morphological parse contains
  * tag DATE), the attribute will have the value "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public IsDateAttribute(MorphologicalParse parse) : base(parse.IsDate())
 {
 }
 /**
  * <summary>Binary attribute for a given word. If the word is represents a fraction (if the morphological parse contains
  * tag FRACTION), the attribute will have the value "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public IsFractionAttribute(MorphologicalParse parse) : base(parse.IsFraction())
 {
 }
 /**
  * <summary> Binary attribute for a given word. If the word is an adjective, the attribute will have
  * the value "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public IsAdjectiveAttribute(MorphologicalParse parse) : base(parse.IsAdjective())
 {
 }
Exemplo n.º 13
0
 public void SetMorphologicalAnalysis(MorphologicalParse parse)
 {
     _layers[ViewLayerType.INFLECTIONAL_GROUP] = new MorphologicalAnalysisLayer(parse.ToString());
     _layers[ViewLayerType.PART_OF_SPEECH]     = new MorphologicalAnalysisLayer(parse.ToString());
 }
 /**
  * <summary> Discrete attribute for a given word. If the last inflectional group of the word contains case information, the
  * attribute will have that case value. Otherwise the attribute will have the value null.</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public CaseAttribute(MorphologicalParse parse) : base(parse.LastIGContainsCase())
 {
 }
Exemplo n.º 15
0
 /**
  * Discrete attribute for a given word. Returns the part of speech of the root word
  * @param parse Morphological parse of the word.
  */
 public RootPosAttribute(MorphologicalParse parse) : base(parse.GetRootPos())
 {
 }
 /**
  * <summary>Binary attribute for a given word. If the word represents a date (if the morphological parse contains
  * tag PROPERNOUN), the attribute will have the value "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public IsProperNounAttribute(MorphologicalParse parse) : base(parse.IsProperNoun())
 {
 }
Exemplo n.º 17
0
 /**
  * <summary>Binary attribute for a given word. If the word is represents a real number (if the morphological parse contains
  * tag REAL), the attribute will have the value "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public IsRealAttribute(MorphologicalParse parse) : base(parse.IsReal())
 {
 }
Exemplo n.º 18
0
 /**
  * <summary>Binary attribute for a given word. If the last inflectional group of the word contains GENITIVE tag,
  * the attribute will be "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public LastIGContainsTagGenitiveAttribute(MorphologicalParse parse) : base(parse, MorphologicalTag.GENITIVE)
 {
 }
 /**
  * <summary>Discrete attribute for a given word. Returns the the root word</summary>
  * <param name="parse">Morphological parse of the word.</param>
  */
 public RootFormAttribute(MorphologicalParse parse) : base(parse.GetWord().GetName())
 {
 }
 /**
  * <summary>Binary attribute for a given word. If the last inflectional group of the word contains tag,
  * the attribute will be "true", otherwise "false".</summary>
  * <param name="parse">Morphological parse of the word.</param>
  * <param name="tag">Tag that is checked in the last inflectional group.</param>
  */
 public LastIGContainsTagAttribute(MorphologicalParse parse, MorphologicalTag tag) : base(parse.LastIGContainsTag(tag))
 {
 }