Reading and Using the Result

This page is for a reader who has run the Quick Start and wants to know what the result says: what a bunsetsu and a dependency are, how to read the result of several kinds of sentence, how to use it in a program, and how far to trust it.

Every output on this page was made with the model a release of Lindera builds for IPADIC and the IPADIC dictionary, the two that lindera dependency download ipadic and lindera dictionary download ipadic install. In the commands, $MODEL and $DICT are the two paths those commands print, as in the Quick Start.

Bunsetsu and dependencies

A Japanese sentence is a sequence of bunsetsu (文節): the smallest pieces a speaker can pause between. A bunsetsu is one content word, with the particles and auxiliaries that follow it:

太郎は | 本を | 読んだ。

A tokenizer cuts this sentence into seven morphemes (太郎, は, 本, を, 読ん, だ, 。). Grouping them into three bunsetsu is the first half of the analysis, the chunking.

Each bunsetsu, except the last of the sentence, modifies one other bunsetsu: it depends on it. 太郎は says who read, and 本を what was read, so both depend on 読んだ。:

太郎は ───┐
本を ─────┤
読んだ。 ◀─┘

Finding these dependencies (係り受け) is the second half, the parsing. The bunsetsu that another depends on is its head.

Two words of a bunsetsu have a name:

  • the head word (主辞) is its content word: 太郎, 本, 読ん;
  • the function word (機能語) is the last particle or auxiliary: は, を, だ. It says how the bunsetsu relates to its head: は marks a topic, を an object.

A bunsetsu without a particle or an auxiliary, such as 赤い, has one word that is both. Head and Function Word has the rule.

What the result gives, and what it does not

For every bunsetsu, the result gives the bunsetsu it depends on. It is a tree with three properties, which a program can rely on:

  • every bunsetsu but the last depends on a later one, never on an earlier one;
  • the last bunsetsu depends on nothing: it is the root, as a rule the main predicate of the sentence;
  • no two dependencies cross.

The result does not say what kind of dependency one is. There is no label such as "subject" or "object". What a bunsetsu is to its head is read from its function word: が and は for who or what, を for an object, に and で for a place or a means, and so on. Using the result shows it.

Reading the result

The result comes in two forms, with the same content:

  • the lattice format of lindera dependency parse, which is what cabocha -f1 writes;
  • fields on the tokens of the Lindera tokenizer, with the token filter japanese_dependency.

The lattice format

% echo "太郎は昨日買った新しい本を図書館で読んだ。" \
    | lindera dependency parse --model "$MODEL" --dict "$DICT"
* 0 6D 0/1 0.000000
太郎	名詞,固有名詞,人名,名,*,*,太郎,タロウ,タロー
は	助詞,係助詞,*,*,*,*,は,ハ,ワ
* 1 2D 0/0 0.854030
昨日	名詞,副詞可能,*,*,*,*,昨日,キノウ,キノー
* 2 4D 0/1 1.385440
買っ	動詞,自立,*,*,五段・ワ行促音便,連用タ接続,買う,カッ,カッ
た	助動詞,*,*,*,特殊・タ,基本形,た,タ,タ
* 3 4D 0/0 1.360641
新しい	形容詞,自立,*,*,形容詞・イ段,基本形,新しい,アタラシイ,アタラシイ
* 4 6D 0/1 0.000000
本	名詞,一般,*,*,*,*,本,ホン,ホン
を	助詞,格助詞,一般,*,*,*,を,ヲ,ヲ
* 5 6D 0/1 0.000000
図書館	名詞,一般,*,*,*,*,図書館,トショカン,トショカン
で	助詞,格助詞,一般,*,*,*,で,デ,デ
* 6 -1D 0/1 0.000000
読ん	動詞,自立,*,*,五段・マ行,連用タ接続,読む,ヨン,ヨン
だ	助動詞,*,*,*,特殊・タ,基本形,だ,ダ,ダ
。	記号,句点,*,*,*,*,。,。,。
EOS

A line that starts with * opens a bunsetsu, and the lines under it are its morphemes. Take * 2 4D 0/1 1.385440:

PartHereMeaning
The number of the bunsetsu2Counted from 0 in the sentence: 買った
The number of its head4買った depends on bunsetsu 4, 本を. -1 for the last bunsetsu, which has no head
The letterDA dependency. The parser gives every dependency this letter; the other letters of the format (P, A, I) are kinds of dependency that only annotated data has. A coordination is D too: in the training data only a coordination with と is P, and one with や or of predicates is D, so a P learned from it would be one of と alone (#1527, design notes)
The two positions0/1The head word is morpheme 0 of the bunsetsu (買っ) and the function word morpheme 1 (た)
The score1.385440The score of the decision: see The score

Read bunsetsu by bunsetsu, the sentence is:

BunsetsuDepends on
0太郎は6 読んだ。Who read
1昨日2 買ったWhen it was bought
2買った4 本をWhich book: the one that was bought
3新しい4 本をWhich book: the new one
4本を6 読んだ。What was read
5図書館で6 読んだ。Where
6読んだ。The root

Two things to see here. A noun can have several modifiers, each with its own dependency: 買った and 新しい both depend on 本を. And a dependency can be long: 太郎は depends on the last bunsetsu, six away, over a clause that has nothing to do with it. 昨日 depends on 買った, not on 読んだ。: the analysis reads "the book bought yesterday", not "read yesterday".

The fields on a token

With the token filter, each token carries the same information in its dependency (Token Filter has every way to use the filter):

% echo "太郎は花子が書いた手紙を読んだ。" | lindera tokenize --dict "$DICT" --output json \
    --token-filter "japanese_dependency:{\"model\":\"$MODEL\"}"

The surface of each token of the JSON output with the fields of its dependency:

Tokensentencebunsetsuheadrolescore
太郎004head0.0
は004function0.0
花子012head0.9022112173766716
が012function0.9022112173766716
書い023head0.9992820743791815
た023function0.9992820743791815
手紙034head0.0
を034function0.0
読ん04nullhead0.0
だ04nullfunction0.0
。04nullother0.0

The tokens with the same bunsetsu are one bunsetsu, and all of them have the head of that bunsetsu. role says which token is the head word and which the function word. Read as bunsetsu:

BunsetsuDepends on
0太郎は4 読んだ。Who read
1花子が2 書いたWho wrote
2書いた3 手紙をWhich letter: the one that was written
3手紙を4 読んだ。What was read
4読んだ。The root

The sentence has a clause inside a clause, and the dependencies keep the two apart: 花子が depends on 書いた, the verb of the inner clause, and 太郎は on 読んだ。, the verb of the outer one.

More kinds of sentence

The tables below are read from the output of lindera dependency parse, as the one above.

A quotation: 彼は明日来ると言った。

BunsetsuDepends on
0彼は3 言った。
1明日2 来ると
2来ると3 言った。
3言った。

What was said is a clause that ends in と, and its last bunsetsu, 来ると, depends on the verb of saying. 明日 belongs to the quotation, and 彼は to 言った。.

Two clauses in a row: 猫が魚を食べ、犬が骨をかじった。

BunsetsuDepends on
0猫が2 食べ、
1魚を2 食べ、
2食べ、5 かじった。
3犬が5 かじった。
4骨を5 かじった。
5かじった。

Each verb has its own subject and object. The first clause is attached to the second by its verb: 食べ、 depends on かじった。. Two things side by side are a dependency like any other, of the first on the second; nothing in the result marks them as parallel.

A reason: 雨が降ったので、試合は中止になった。

BunsetsuDepends on
0雨が1 降ったので、
1降ったので、4 なった。
2試合は4 なった。
3中止に4 なった。
4なった。

A clause that gives a reason, a time or a condition depends on the predicate of the main clause by its last bunsetsu, here 降ったので、.

Using the result

The usual way to use the result is to turn it around: for a bunsetsu, collect the bunsetsu that depend on it. For a verb, that gives who did what, where and when; for a noun, what describes it.

This program puts the bunsetsu of a sentence together from its tokens, and prints, for the bunsetsu whose head word is a verb or an adjective and then for those whose head word is a noun, the bunsetsu that depend on each, with their function words:

use std::path::Path;

use lindera::analysis::token_filter::BoxTokenFilter;
use lindera::analysis::token_filter::japanese_dependency::JapaneseDependencyTokenFilter;
use lindera::analysis::tokenizer::Tokenizer;
use lindera::dictionary::load_dictionary;
use lindera::mode::Mode;
use lindera::segmenter::Segmenter;
use lindera::token::{BunsetsuRole, Token};

/// A bunsetsu, put together from the tokens that have its number.
#[derive(Default)]
struct Bunsetsu {
    /// The surfaces of its tokens, joined.
    text: String,
    /// The bunsetsu it depends on.
    head: Option<usize>,
    /// The part of speech of its head word.
    part_of_speech: String,
    /// Its function word, when it has one that is not its head word.
    function_word: Option<String>,
}

/// The bunsetsu of one sentence.
fn bunsetsu_of(tokens: &mut [Token]) -> Vec<Bunsetsu> {
    let mut bunsetsu: Vec<Bunsetsu> = Vec::new();
    for token in tokens {
        let Some(dependency) = token.dependency().cloned() else {
            continue;
        };
        let number = dependency.bunsetsu as usize;
        if bunsetsu.len() <= number {
            bunsetsu.resize_with(number + 1, Bunsetsu::default);
        }
        let surface = token.surface.to_string();
        let part_of_speech = token.get_detail(0).unwrap_or("*").to_string();
        let one = &mut bunsetsu[number];
        one.text.push_str(&surface);
        one.head = dependency.head.map(|head| head as usize);
        match dependency.role {
            BunsetsuRole::Head | BunsetsuRole::HeadAndFunction => {
                one.part_of_speech = part_of_speech;
            }
            BunsetsuRole::Function => one.function_word = Some(surface),
            BunsetsuRole::Other => {}
        }
    }
    bunsetsu
}

/// Prints each bunsetsu whose head word has one of the parts of speech,
/// with the bunsetsu that depend on it and their function words.
fn print_dependents(bunsetsu: &[Bunsetsu], parts_of_speech: &[&str]) {
    for (number, one) in bunsetsu.iter().enumerate() {
        if !parts_of_speech.contains(&one.part_of_speech.as_str()) {
            continue;
        }
        let dependents: Vec<String> = bunsetsu
            .iter()
            .filter(|other| other.head == Some(number))
            .map(|other| match &other.function_word {
                Some(word) => format!("{} ({word})", other.text),
                None => other.text.clone(),
            })
            .collect();
        if !dependents.is_empty() {
            println!("  {} <- {}", one.text, dependents.join(", "));
        }
    }
}

fn main() -> lindera::LinderaResult<()> {
    // The paths that `lindera dictionary download ipadic` and
    // `lindera dependency download ipadic` print.
    let mut args = std::env::args().skip(1);
    let dictionary = args.next().expect("the directory of the dictionary");
    let model = args.next().expect("the model file");

    let dictionary = load_dictionary(&dictionary)?;
    let mut tokenizer = Tokenizer::new(Segmenter::new(Mode::Normal, dictionary, None));
    let filter = JapaneseDependencyTokenFilter::from_path(Path::new(&model))?;
    tokenizer.append_token_filter(BoxTokenFilter::from(filter));

    for sentence in [
        "太郎は昨日買った新しい本を図書館で読んだ。",
        "太郎は花子が書いた手紙を読んだ。",
    ] {
        let mut tokens = tokenizer.tokenize(sentence)?;
        let bunsetsu = bunsetsu_of(&mut tokens);
        println!("{sentence}");
        println!(" what depends on a verb or an adjective:");
        print_dependents(&bunsetsu, &["動詞", "形容詞"]);
        println!(" what depends on a noun:");
        print_dependents(&bunsetsu, &["名詞"]);
    }
    Ok(())
}

With lindera = { version = "7.1", features = ["dependency"] } and the two paths as its arguments, it prints:

太郎は昨日買った新しい本を図書館で読んだ。
 what depends on a verb or an adjective:
  買った <- 昨日
  読んだ。 <- 太郎は (は), 本を (を), 図書館で (で)
 what depends on a noun:
  本を <- 買った (た), 新しい
太郎は花子が書いた手紙を読んだ。
 what depends on a verb or an adjective:
  書いた <- 花子が (が)
  読んだ。 <- 太郎は (は), 手紙を (を)
 what depends on a noun:
  手紙を <- 書いた (た)
  • Who did what. The line of 読んだ。 is the event of the sentence: 太郎 with は, 本 with を, 図書館 with で. A program that wants subjects and objects takes the dependents of a verb and looks at their function words: が and は for the one who acts, を for what is acted on. In the second sentence the two verbs have their own lines, and 花子が is with 書いた alone.
  • What describes a noun. The line of 本を has the clause 買った and the adjective 新しい. A clause that modifies a noun is attached by its last bunsetsu, so 買った stands for 昨日買った: to get the whole modifier, follow the dependents of 買った in turn.
  • One sentence at a time. The numbers of the bunsetsu start again in each sentence. A text of several sentences gives tokens with another sentence, and the bunsetsu are put together for each: see Sentences.

The same fields are on the tokens of the bindings and of the JSON output of lindera tokenize, and the program is the same in another language.

In search: dependency pairs

A search engine can use the result to prefer, among the documents that have the words of a query, the ones that say the same relation. The query 頭痛を治す薬 has the words 頭痛, 治す and 薬. So do a text on how to choose a medicine for a headache and a text that says a medicine gives a headache. What tells them apart is a dependency: in the query and in the first text, 頭痛を depends on 治す.

A dependency pair is one dependency written as a term: the head word of a bunsetsu with the head word of the bunsetsu it depends on. It has two forms:

  • <word>><head word>, such as 頭痛>治す;
  • <word>/<particle>><head word>, such as 頭痛/を>治す, for a bunsetsu whose function word is a particle.

The words are base forms, so that 治す and 治さ give the same pair.

This program prints the pairs of eight texts:

use std::collections::BTreeMap;
use std::path::Path;

use lindera::analysis::token_filter::BoxTokenFilter;
use lindera::analysis::token_filter::japanese_dependency::JapaneseDependencyTokenFilter;
use lindera::analysis::tokenizer::Tokenizer;
use lindera::dictionary::load_dictionary;
use lindera::mode::Mode;
use lindera::segmenter::Segmenter;
use lindera::token::{BunsetsuRole, Token};

/// What a pair needs of a bunsetsu.
struct Bunsetsu {
    /// The bunsetsu it depends on.
    head: Option<u32>,
    /// The base form of its head word.
    word: Option<String>,
    /// Its function word, when that is a particle.
    particle: Option<String>,
}

/// The dependency pairs of a text: `<word>><head word>` for each bunsetsu
/// that depends on another, and `<word>/<particle>><head word>` too when the
/// bunsetsu has a particle.
fn pairs_of(tokens: &mut [Token]) -> Vec<String> {
    // The bunsetsu, by the number of their sentence and their number in it.
    let mut bunsetsu: BTreeMap<(u32, u32), Bunsetsu> = BTreeMap::new();
    for token in tokens {
        let Some(dependency) = token.dependency().cloned() else {
            continue;
        };
        let surface = token.surface.to_string();
        let is_particle = token.get_detail(0) == Some("助詞");
        let base_form = match token.get("base_form") {
            Some(form) if form != "*" => form.to_string(),
            _ => surface.clone(),
        };
        let one = bunsetsu
            .entry((dependency.sentence, dependency.bunsetsu))
            .or_insert(Bunsetsu {
                head: dependency.head,
                word: None,
                particle: None,
            });
        match dependency.role {
            BunsetsuRole::Head | BunsetsuRole::HeadAndFunction => one.word = Some(base_form),
            BunsetsuRole::Function if is_particle => one.particle = Some(surface),
            _ => {}
        }
    }

    let mut pairs = Vec::new();
    for (&(sentence, _), one) in &bunsetsu {
        let head = one.head.and_then(|head| bunsetsu.get(&(sentence, head)));
        let (Some(word), Some(head_word)) = (&one.word, head.and_then(|head| head.word.as_ref()))
        else {
            continue;
        };
        pairs.push(format!("{word}>{head_word}"));
        if let Some(particle) = &one.particle {
            pairs.push(format!("{word}/{particle}>{head_word}"));
        }
    }
    pairs
}

fn main() -> lindera::LinderaResult<()> {
    // The paths that `lindera dictionary download ipadic` and
    // `lindera dependency download ipadic` print.
    let mut args = std::env::args().skip(1);
    let dictionary = args.next().expect("the directory of the dictionary");
    let model = args.next().expect("the model file");

    let dictionary = load_dictionary(&dictionary)?;
    let mut tokenizer = Tokenizer::new(Segmenter::new(Mode::Normal, dictionary, None));
    let filter = JapaneseDependencyTokenFilter::from_path(Path::new(&model))?;
    tokenizer.append_token_filter(BoxTokenFilter::from(filter));

    for text in [
        "頭痛を素早く治す市販薬の選び方を解説する。",
        "この薬を飲むと頭痛になることがある。",
        "頭痛は治さずに放置した。",
        "犬が人を噛んだ。",
        "人が犬を噛んだ。",
        "人が犬に噛まれた。",
        "人を噛んだ犬。",
        "人を噛んだ犬",
    ] {
        let mut tokens = tokenizer.tokenize(text)?;
        println!("{text}");
        println!("  {}", pairs_of(&mut tokens).join(" "));
    }
    Ok(())
}

With the same line in Cargo.toml and the same two arguments as the program above, it prints:

頭痛を素早く治す市販薬の選び方を解説する。
  頭痛>治す 頭痛/を>治す 素早い>治す 治す>薬 薬>選び方 薬/の>選び方 選び方>解説 選び方/を>解説
この薬を飲むと頭痛になることがある。
  この>薬 薬>飲む 薬/を>飲む 飲む>なる 飲む/と>なる 頭痛>なる 頭痛/に>なる
頭痛は治さずに放置した。
  頭痛>治す 頭痛/は>治す 治す>放置 治す/に>放置
犬が人を噛んだ。
  犬>噛む 犬/が>噛む 人>噛む 人/を>噛む
人が犬を噛んだ。
  人>噛む 人/が>噛む 犬>噛む 犬/を>噛む
人が犬に噛まれた。
  人>噛む 人/が>噛む 犬>噛む 犬/に>噛む
人を噛んだ犬。
  人>噛む 人/を>噛む 噛む>犬
人を噛んだ犬
  人>噛む 人/を>噛む 噛む>犬
  • In an index. The pairs of a document go into a field of their own, apart from the text, as terms that are not cut again. A query finds the documents by its words, and a document that has a pair of the query gets a higher score. The pairs raise a score and do not filter: the analysis is wrong for some bunsetsu (How far to trust the result), and a text that says the same with another word (通行人 for 人) has no pair in common with the query.
  • The pairs with a particle tell the roles apart. 犬が人を噛んだ。 and 人が犬を噛んだ。 have the same two pairs without a particle, 犬>噛む and 人>噛む, and differ in the pairs with one: 犬/が>噛む against 犬/を>噛む. Give the pairs with a particle more weight. The particle is not the role, though: in the passive 人が犬に噛まれた。, the one who is bitten has が.
  • A text that does not end a sentence. A query often ends with a noun and has no period. It gives the pairs it gives with one: 人を噛んだ犬 and 人を噛んだ犬。 both have 人>噛む and 噛む>犬. Lindera 7.1 joined the last noun to the bunsetsu before it, which gave 人>犬, and a 。 had to be added to such a text; from 7.2 on the chunker is trained with texts that have no period (#1499).
  • What a pair does not say. The head word of a compound is its last word: 市販薬 gives 薬. A clause that modifies a noun gives the pair of the clause and the noun, 噛む>犬, and not that the dog is the one who bit. Negation is not in a pair: 頭痛は治さずに gives 頭痛>治す. And a pair is one dependency: 薬 and 解説 in the first text, two dependencies apart, are in no pair.

From 7.2.0 on, the token filter japanese_dependency_pair makes these pairs inside the tokenizer, one form for a filter. It is what a configuration file names where a program like the one above cannot be written, and what a tokenizer of a field of pairs has.

lindera-tantivy has an example that runs on a search engine: its examples/dependency_pairs.rs indexes twenty documents with Tantivy, with their pairs in fields of their own that the token filter japanese_dependency_pair fills, and its README compares five ways to query them for three queries: OR, AND and a phrase of the words, OR with a weight added for each pair of the query, and OR for the documents that have a pair of the query with its particle.

lindera-sqlite has the same example on SQLite, with the same documents, queries and ways to query. Its e2e/examples/dependency_pairs/main.rs keeps the text in an FTS5 table with the Lindera tokenizer and the pairs in a plain table, since a tokenizer of FTS5 passes no pair to the index, and one statement adds a weight for each pair of the query to the bm25() of a document.

Order, relation or meaning

Three kinds of search look at three things:

SearchWhat has to matchWhat it is
Phrase searchThe order: the words of the query, next to each otherExact, on the surface
Dependency pairsThe relation: which word depends on which, inside one sentenceExact, on the structure
Vector searchThe meaning: how near the text is to the queryApproximate

Next to phrase search. A phrase matches where its tokens stand in a row, and a pair where the relation holds, whatever stands in between. The query 人を噛んだ, as the phrase 人 / を / 噛ん / だ and as the pair 人/を>噛む:

TextThe phraseIts pairs with a particleThe pair
人を噛んだ犬Yes人/を>噛むYes
人を強く噛んだ犬No人/を>噛むYes
人を昨日公園で噛んだ犬No人/を>噛む 公園/で>噛むYes
犬が人を噛んだYes犬/が>噛む 人/を>噛むYes
人を犬が噛んだNo人/を>噛む 犬/が>噛むYes
犬を噛んだ人No犬/を>噛むNo
人を見て、犬が骨を噛んだNo人/を>見る 見る/て>噛む 犬/が>噛む 骨/を>噛むNo

A word between the two (強く, 昨日公園で) or another order (人を犬が噛んだ) breaks the phrase and leaves the pair. A phrase search that allows words in between finds the second and the third text again, and with them texts in which 人を and 噛んだ are near each other without belonging together, as in the last one, where 人を depends on 見て.

Next to vector search. A vector search ranks texts by how near their meaning is to the query, with an embedding model. It finds another wording of the same thing, which no pair does: 噛みついた is another word than 噛んだ. It is weaker where the words are the same and the relation is the other way round, as 人を噛んだ犬 and 犬を噛んだ人 are, since the two texts are close to each other for most models; the pairs of the two are different terms. A pair either matches or does not, and the pair that matched says why a document was found.

A pair is a term of an inverted index, like a word. A search with pairs is as fast as a full-text search is, on the same index, and needs neither an embedding model nor a GPU; the cost is at indexing time, where the text is analyzed.

What the pairs do not do.

  • The roles are told apart by the pairs with a particle only: 人を噛んだ and 人が噛んだ both give 人>噛む.
  • A clause that modifies a noun and a sentence with the same event have different pairs: 人を噛んだ犬 gives 噛む>犬, and 犬が人を噛んだ gives 犬/が>噛む.
  • Where the analysis is wrong, a pair is missing or is another one (How far to trust the result). A phrase search does not depend on an analysis.

The three go together. The words and the phrases of a query find the documents, a vector search adds those that say it in other words, and the pairs raise the documents that say the same relation.

How far to trust the result

The analysis is a statistical model, trained on UD Japanese-GSD, and it is wrong in some sentences.

How often it is right. On the test files, from plain text, the head of a bunsetsu is right for about 85 bunsetsu in 100 (85.55% on the dev file of UD Japanese-GSD, 84.72% on its test file, 86.11% on UD Japanese-PUD), not counting the last bunsetsu of a sentence, which has no head. A wrong head can come from a bunsetsu cut at the wrong place or from the parser: with the bunsetsu given, the parser alone is right for 90.09%, 88.66% and 88.72%. Parsing has the numbers, and those for UniDic.

A wrong answer: 私は友人と京都の古い寺を訪ねた。

BunsetsuDepends onScore
0私は5 訪ねた。0.000000
1友人と2 京都の0.194373
2京都の4 寺を1.083599
3古い4 寺を1.377646
4寺を5 訪ねた。0.000000
5訪ねた。0.000000

友人と, "with a friend", belongs to 訪ねた。. The model attaches it to 京都の, as if it were "a friend and Kyoto": と is also the particle that joins two nouns, and the noun right after it is the nearest candidate.

This is a kind of error to expect. IPADIC gives と the part of speech of the particle that joins two nouns (並立助詞) whenever a noun follows it, whatever it means, so 友人と京都の looks to the parser as 東京と京都の does, which is "Tokyo and Kyoto". What tells the two apart is meaning (a friend and a city do not go together), which neither the morphemes nor the training data give: CaboCha and J.DepP, trained on the same data, make the same error. In a cross-validation of the training data, the parser has 13 right of the 93 bunsetsu of this kind: a と of 並立助詞 whose head is not the next bunsetsu, in a dependency that is no coordination. Nothing that was tried did better without making the true coordinations worse (#1528). Its score is the sign to look at (below).

A sentence with two readings: 美しい水車小屋の娘が歌った。

BunsetsuDepends onScore
0美しい1 水車小屋の0.572737
1水車小屋の2 娘が1.691532
2娘が3 歌った。0.000000
3歌った。0.000000

Is the mill beautiful, or the girl? Both are Japanese, and the result has one of them: the mill. A dependency analysis gives one tree for a sentence, and where the sentence itself allows two, it takes the one its training data makes more likely.

The score

The score of a bunsetsu is the score of the decision that attached it to its head. The parser asks, for a bunsetsu and a candidate after it, whether the first depends on the second, and attaches it when the score is above 0 (How a sentence is parsed).

  • A score near 0 is a decision that was close. 友人と above has 0.194373, the lowest score above 0 on this page, and is the wrong one.
  • A と attached to the next bunsetsu with a low score is often wrong. In the cross-validation of the training data, a bunsetsu that ends with a と of 並立助詞 and is attached to the next bunsetsu is wrong 27 times in 49 with a score below 0.25, 22 times in 86 from 0.25 to 0.5, and 48 times in 271 from 0.5 on (#1528). Below 0.25 it is wrong more often than right.
  • A larger score is not a probability, and scores are not comparable between models.
  • The score is 0 where nothing was decided: for a bunsetsu that depends on the last bunsetsu of its sentence, and for the last one. Those are the bunsetsu no earlier candidate took, so the last bunsetsu is what is left for them. A 0 does not say that the dependency is in doubt, and does not say that it is sure.