Morphology & Dependency Trees

The analyzeSyntax method returns details about the linguistic structure of the given text. For each token in the text, the Natural Language API provides information about its internal structure (morphology) and its role in the sentence (syntax).

Morphology is the study of the internal structure of words.. Morphology focuses on how the components within a word (stems, root words, prefixes, suffixes, etc.) are arranged or modified to create different meanings. English, for example, often adds "-s" or "-es" to the end of count nouns to indicate plurality, and a "-d" or "-ed" to a verb to indicate past tense. The suffix “-ly” is added to adjectives to create adverbs (for example, “happy” [adjective] and “happily” [adverb]).

The Natural Language API uses morphological analysis to infer grammatical information about words.

Morphology varies greatly between languages. In languages such as Russian, word endings indicate the role of a word in a sentence (for example, “книга” [book - nominative case] becomes “книгу” [accusative case] when it’s the direct object of a verb). This means word order can vary without changing the meaning of the sentence, though different word order does impact contextual appropriateness. Languages such as English and Mandarin, which both lack affixes indicating case, rely more on the word order in a sentence to indicate the respective roles of words. As a result, morphological analysis depends heavily on the source language, and an understanding of what is supported within that language.

Syntax is the study of the structure of phrases and sentences. Syntax and morphology work together to indicate grammatical relationships, with different languages dividing the labor between them differently. For example, Russian uses an affix to indicate the role of direct object (“у” in “книгу”), whereas English uses word order, where the direct object follows the verb (read the book).

The analyzeSyntax response returns morphological information in the partOfSpeech field and the syntactic relationship between words in the dependencyTree field.

Parts of Speech

Within a syntactic request, part-of-speech and morphological information are returned within the response's partOfSpeech field. The partOfSpeech field contains a set of sub-fields with Part-of-Speech (POS) information as well as more explicit morphological information. These subfields are listed below.

  • tag denotes the part of speech using a coarse-grained POS tag (NOUN, VERB, etc.), and provides top-level surface syntax information. POS tags are helpful if you want to create patterns and/or reduce ambiguity for subsequent language analysis (for example, “train” tagged as a NOUN versus a VERB).

  • number denotes a word's grammatical number. In English, the suffix "-s" is added to count nouns to indicate more than one (for example, “dog+s” indicates more than one dog). Absence of the plural suffix is often referred to as the singular form. Some languages, such as Arabic, have the notion of a dual number as well. This field may contain the following values:

    • SINGULAR denotes one quantity.
    • PLURAL denotes more than one quantity.
    • DUAL denotes precisely two quantities.
  • person identifies a word's grammatical person. In English, “I/me” is 1st person singular and references the speaker (or writer) of the expression, whereas “you” and “she/her and he/him” reference the intended addressee (hearer) and some other person, respectively. This field may contain the following values:

    • FIRST person denotes the speaker.
    • SECOND person denotes intended addressee, that is, the person spoken to.
    • THIRD person denotes non-speaker/non-hearer.
    • REFLEXIVE_PERSON indicates, for example, the subject and the object reference the same entity, as in “The cat licked itself,” where -self attaches to a pronoun to indicate reflexivity. In Russian and Japanese, the reflexive is a standalone pronoun. (for example, “John loves himself” in Russian is “Джон любит себя” where себя is gender neutral “self”; in Japanese it’s “Tarō wa zibun o aisuru” (Romanized version) where “zibun” is gender neutral “self.” See reflexive pronoun.
  • gender denotes a noun's grammatical gender. This field may contain the following values:

    • The FEMININE grammatical gender
    • The MASCULINE grammatical gender
    • The NEUTER grammatical gender
  • case denotes a word's grammatical case and its role in a phrase or sentence. This field may contain the following values::

    • The ACCUSATIVE case indicates the direct object of a transitive verb.
    • The ADVERBIAL case indicates an adverbial form of an adjective. Note that English uses separate words adverbs ("well") and adjectives ("good"). The suffix -ly in English does derive adverbs from adjectives (for example, “happy,” “happily”), though it’s not considered a “case”.
    • The COMPLEMENTIVE case (Chinese) indicates a word necessary to complete the meaning of a potential, descriptive, or resultative expression using a conjunctive particle.
    • The DATIVE case indicates an indirect object, which refers to the referent receiving the direct object. In English, the indirect object is often indicated by the preposition "to" as in the phrase "He gave the ball to Bobby," where “Bobby” is the indirect object, and is the recipient of the ball. Whereas in this Russian example: Иван дал книгу маше (Ivan gave the book to Masha), “-e” indicates “маше” is the indirect object, and Masha is the recipient of the book.
    • The GENITIVE case indicates possession. Note that English often indicates possession using the "-'s" affix instead of using a genitive case. The "-'s" affix can can attach to the end of a phrase (for example, “[The man who ran the bill up]’s wife paid a dear price for his excess.”). Whereas in this Russian example, “-а” marks “Антон-” as genitive: “Где книга Антона?” (Where is Anton’s book). In Russian, the genitive case also shows up as the complement of words like “several,” “few.” For example: Зимой здесь мало снега (“In winter there is little snow here”) “-a” marks “снег-” (snow) as genitive, since it is the complement of “мало” (“little”). There is no possession involved.
    • The INSTRUMENTAL case indicates whether a noun is the instrument by which an action is completed. In Russian, the English sentence, "He opened the door with a key," would be: “он открыл дверь ключом” where “-om” attaches to “ключ” (key) indicating instrumental case.
    • The LOCATIVE case indicates a word's use to refer to a location. English, does not have a locative case.
    • The NOMINATIVE case is associated with the subject of a verb. In English, the subject of a sentence is indicated through word order, not case. In the sentence, “The girl won the race,” the phrase “the girl” is the subject, appearing to the left of the verb, “won.” In Russian, девушка (the/a girl) can appear either before or after the verb: “девушка выиграла гонку” or “гонку выиграла девушка”, where the verb is выиграла (won).
    • The OBLIQUE case indicates a word's use as an object to either a verb or preposition.
    • The PARTITIVE case indicates a word's "partialness" or lack of specific identity. An example of a partitive in English would be “three of my friends.” In Russian, this would be “трое моих друзей” where “трое” is “three of” (compare with “три друга” where “три” is “three”).
    • The PREPOSITIONAL case indicates the object of a preposition.
    • The REFLEXIVE_CASE indicates the identity of an object of a verb to its subject. Most languages do not use a reflexive case, as this usage is indicated through use of special reflexive pronouns instead (such as "himself", "myself", etc.")
    • The RELATIVE_CASE (Chinese) indicates the complementizer of a relative clause connecting a noun with a verb or adjective. Examples: 工作 [的] 地方 (work [] place :: "place [where I] work"). 便宜 的 餐馆 (inexpensive [] restaurants :: restaurants [that are] inexpensive).
    • The VOCATIVE case indicates a noun being used to address someone or something, usually when spoken to.
  • tense denotes a verb's grammatical tense, which indicates the verb's reference to a position in time. Note that tense is distinct from aspect, which also deals with a verb's relationship to time, but focuses on the characteristics of that time flow, rather than its position. The IMPERFECT and PLUPERFECT tenses in many languages more accurately refer to specific combinations of tense and aspect. This field may contain the following values:

    • CONDITIONAL_TENSE is an alternate term for the more prevalent morphological term of "conditional mood." (See CONDITIONAL_MOOD below.)
    • FUTURE denotes an action taking place in the future. Note that in English, the future tense is most often denoted by adding the word "will" to a verb phrase.
    • PAST denotes an action taking place in the past.
    • PRESENT denotes an action taking place in the present.
    • IMPERFECT denotes an action taking place in the past, but which was not completed at that tense's frame of reference. Note that in English, the imperfect tense is most often denoted by adding a gerund form of a verb to the past tense as in "I was walking." An imperfect tense event takes place in the past, but is not completed relative to that past tense.
    • PLUPERFECT denotes an action that has taken place in the past, and was also completed at that tense's frame of reference. For example, "I had walked" takes place in the past, but was also complete during the past tense's frame of reference.
  • aspect denotes a verb's grammatical aspect, its expression of time flow. Unlike tense, which focuses on a verb's position within time, aspect focuses on the characteristics of that time flow where it occurs. This field may contain the following values:

    • The PERFECTIVE aspect denotes an event that is "completed" either because it has completely happened in the past or will completely happen in the future.
    • The IMPERFECTIVE aspect denotes an event that is incomplete, either because it is continuous or because it is repeated.
    • The PROGRESSIVE aspect denotes an event that is continuous. A progressive aspect is generally treated as a special case of the more general imperfective aspect (which also covers repetition).

  • mood denotes a verb's grammatical mood, which indicates attitude about an underlying action. This field may contain the following values:

    • CONDITIONAL_MOOD indicates an action which is contingent. Note that in English, verb forms are not conditional; instead, conditional behavior is noted through use of the word "would" combined with the verb's infinitive.
    • IMPERATIVE indicates a command or request through the second person.
    • INDICATIVE indicates a statement of fact, more generally known as a "realis mood."
    • INTERROGATIVE indicates a question.
    • JUSSIVE indicates a command or request through either the first or third person. English does not have a jussive mood, though exhortations that begin with a real or implied "Let us" convey this jussive mood.
    • SUBJUNCTIVE indicates a quality of uncertainty related to an action, also known as an "irrealis" mood (contrasted with the "realis" indicative mood). English does not have a specific subjunctive mood; instead, words such as "want", "wish", "hope", etc. convey the import of the subjunctive mood.
  • voice denotes a verb's grammatical voice, the relationship between an action and a subject and/or object. This field may contain the following values:

    • ACTIVE voice indicates an action whose subject is performing the action.
    • CAUSATIVE voice indicates an action whose effect is being performed on the subject. In English, no direct causative voice exists; instead, such causation is indicated through use of the verb "make", as in "Mom made me go to school."