Migrating from v7.2 to v7.3
This guide lists what v7.3.0 changes for existing code and files. All of it is in bunsetsu dependency analysis (Lindera Dependency). There is one breaking change, in the Rust API of lindera-dependency, and it is in a minor version by a decision of the maintainer, as the ones of v7.2 were (#1529).
Overview
| Change | Affects | What you do |
|---|---|---|
chunker::TrainOptions has a new field, eta | Rust code that builds a lindera_dependency::chunker::TrainOptions with a struct expression that names every field | Add eta: 0.00005, or end the expression with ..Default::default() |
lindera dependency parse cuts a line of text into sentences | Code that reads one EOS for each line of text | Nothing, or --line-as-sentence for a line as one sentence |
| A word of marks is read mark by mark | Code that counts on the bunsetsu or the sentences of a text in which the dictionary joins marks into a word, such as !? or )。 with IPADIC | Nothing: no bunsetsu starts at a sentence end, and such a word ends a sentence |
| An opening bracket that is never closed is no bracket | Code that counts on the sentences of a text with such a bracket | Nothing: the sentences after it are cut |
A model trained with the feature group agree is not read by v7.2 | A program of v7.2 that is given such a model file | Give it a model trained without agree |
Code that analyzes text with a model of this crate, with lindera dependency parse or with the token filter japanese_dependency, needs no change. A model file is still at version 4, and the published models are trained with the settings of v7.2.
TrainOptions of the chunker has a new field
lindera_dependency::chunker::TrainOptions has the field eta: f64 (#1529): the tolerance of the convergence test of the training (see Training a model). TrainOptions is not #[non_exhaustive], so a struct expression that names every field no longer compiles:
error[E0063]: missing field `eta` in initializer of `lindera_dependency::chunker::TrainOptions`
Add eta: 0.00005, which is the tolerance of every training before and the default from v7.3 on. Or end the expression with ..Default::default() or ..TrainOptions::for_dictionary(name)?, which later fields then do not break. lindera dependency train-chunker sets it with --eta.
lindera dependency parse cuts a line of text into sentences
lindera dependency parse cuts each line of text into sentences, by the rule of the token filter japanese_dependency, and writes each sentence with its own EOS (#1521; see A line of several sentences). v7.2 took a line as one sentence, as CaboCha does, and a parser makes a single tree of what it is given: with v7.2, 雨が降った。試合は中止になった。 was one sentence, whose 降った。 depended on 試合は, with one EOS. With v7.3 it is two sentences, 雨が / 降った。 and 試合は / 中止に / なった。, each with its EOS.
--line-as-sentencetakes a line as one sentence, as v7.2 did.- A line of one sentence is one sentence, as before.
- The input layers
morphemesandbunsetsuare not cut: each of their sentences ends with itsEOS, as before.--line-as-sentencewith one of them is an error.
A word of marks is read mark by mark
A dictionary can join marks into a word: IPADIC has no half-width symbol among its words, and gives 行くの!? as 行く, の and !?, and 面白い(笑)。 as 面白い, (, 笑 and )。. v7.3 reads such a word mark by mark, for the sentence ends and for the brackets (#1520; see A text of several sentences and Sentences).
- No bunsetsu starts at a sentence end. A sentence end, and an end or a closing bracket after it, is in the bunsetsu before it, whatever the model gives it. With v7.2, 行くの!? was 行くの / !?, and 彼は「すごい!」と言った。 was 彼は / 「すごい / !」と / 言った。. With v7.3 they are 行くの!? and 彼は / 「すごい!」と / 言った。.
- A word of marks that ends a sentence ends it. With v7.2, the token filter read
)。as no closing bracket, so the(before it stayed open, and 面白い(笑)。次も見る。 was one sentence. With v7.3, 次も見る。 is a sentence of its own.lindera dependency parsecuts its line in the same place. - On the test file of UD Japanese-GSD, the model for IPADIC has a chunking F of 97.02, where v7.2 had 96.89, and 3,361 of the 3,967 dependencies right from the morphemes, where v7.2 had 3,355 (Accuracy). The three UniDic dictionaries give such marks as words of their own, and their numbers do not change.
An opening bracket that is never closed is no bracket
The token filter japanese_dependency cuts no sentence inside brackets. With v7.2, an opening bracket that nothing in the text closed kept the rest of the text in one sentence: 彼は(注を見よ。次へ進む。 was one sentence. With v7.3 such a bracket is no bracket, and 次へ進む。 is a sentence of its own (#1520). lindera dependency parse cuts its line in the same place.
A model trained with the group agree
The parser has a new group of features, agree, which is not in the default set (#1528; see The feature set). v7.2 and v7.3 read each other's model files, but v7.2 refuses one whose parser was trained with agree:
the model has a feature set that is not one: "agree" is not a group of features
The published models, and train-parser without --features, do not use the group.