Skip to content

[en] Different sentence splitting in the GUI and the command line #6318

Description

@MikeUnwalla

The different sentence splitting causes inconsistent analysis of text.

Example sentences:

The cat sat on the mat.
The dog ate a bone.
Then another cat sat on the mat.

The GUI shows 3 sentences:
image

If a sentence contains 2 instances of the word 'cat', this rule finds the first instance:

      <rule id="TEST_SENTENCE_SPLIT" name="test sentence splitting">
        <pattern>
          <marker>
            <token skip="-1">cat</token>
          </marker>
          <token>cat</token>
        </pattern>
        <message>Found the first cat.</message>
        <example type="incorrect">My <marker>cat</marker> and your cat both sat on a mat.</example>
        <example type="correct">Then another cat sat on the mat.</example>
      </rule>

Put the example sentences into a file (test-data.txt) and use the command line to analyse the sentences. The results from the command line give a false warning:

D:\LanguageTool-5.7-SNAPSHOT>java -jar languagetool-commandline.jar -l en-US -eo -e TEST_SENTENCE_SPLIT test-data.txt
Expected text language: English (US) (no spell checking active)
Working on test-data.txt...
1.) Line 1, column 5, Rule ID: TEST_SENTENCE_SPLIT[1]
Message: Found the first cat.
?The cat sat on the mat.  The dog ate a bone.  Then a...
     ^^^
Time: 1638ms for 1 sentences (0.6 sentences/sec)

The sentence splitting is different in the command line analysis. There is only one sentence:

D:\LanguageTool-5.7-SNAPSHOT>java -jar languagetool-commandline.jar -l en-US -t -eo -e TEST_SENTENCE_SPLIT test-data.txt
Expected text language: English (US) (no spell checking active)
Working on test-data.txt...
<S>  The[the/DT] cat[cat/NN,E-NP-singular] sat[sit/VBD,B-VP] on[on/IN,on/JJ,on/RP,B-PP] the[the/DT,B-NP-singular] mat[mat/JJ,mat/NN,E-NP-singular].[./.,./PCT,O]  The[the/DT,B-NP-singular] dog[dog/NN,E-NP-singular] ate[ate/NN,eat/VBD,B-VP] a[a/DT,B-NP-singular] bone[bone/NN:UN,E-NP-singular].[./.,./PCT,O]  My[I/PRP$_A1S,my/PRP$,B-NP-singular] cat[cat/NN,E-NP-singular] likes[like/NNS,like/VBZ,B-VP] your[you/PRP$_A2S,you/PRP$_A2P,your/PRP$,B-NP-singular] dog[dog/NN,E-NP-singular].[./.,</S>./PCT,O]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions