Filosoft / vabamorf

Eesti keele morfanalüsaator
Other
24 stars 14 forks source link

Analüsaatori JSON väljundis tõstetakse pika lause puhul sõnu ümber #5

Closed soras closed 10 years ago

soras commented 10 years ago

Komistasin sellise vea otsa: kui sisendlause on pikem kui 10 sõna, muutub morfoloogilise analüsaatori JSON väljundis sõnade paigutus ning lause lõpus olevad sõnad (alates 11ndast sõnast) paigutatakse väljundis lause algusesse.

Näide. Kui sisendlause on:

{
    "paragraphs": [
        {
            "sentences": [
                {
                    "words": [
                        {
                            "text": "Homme"
                        },
                        {
                            "text": "tiheneb"
                        },
                        {
                            "text": "kõikjal"
                        },
                        {
                            "text": "pilvisus"
                        },
                        {
                            "text": "ja"
                        },
                        {
                            "text": "vihmasadu"
                        },
                        {
                            "text": "laieneb"
                        },
                        {
                            "text": "õhtuks"
                        },
                        {
                            "text": "üle"
                        },
                        {
                            "text": "Eesti,"
                        },
                        {
                            "text": "mitmel"
                        },
                        {
                            "text": "pool"
                        },
                        {
                            "text": "tuleb"
                        },
                        {
                            "text": "äikest."
                        }
                    ]
                }
            ]
        }
    ]
}

siis analüsaatori väljund on järgmine:

{
        "paragraphs": [
                {
                        "sentences": [
                                {
                                        "words": [
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "",
                                                                        "partofspeech": "D",
                                                                        "root": "homme"
                                                                }
                                                        ],
                                                        "text": "Homme"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "b",
                                                                        "form": "b",
                                                                        "partofspeech": "V",
                                                                        "root": "tihene"
                                                                }
                                                        ],
                                                        "text": "tiheneb"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "l",
                                                                        "form": "sg ad",
                                                                        "partofspeech": "P",
                                                                        "root": "mitu"
                                                                }
                                                        ],
                                                        "text": "mitmel"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "",
                                                                        "partofspeech": "K",
                                                                        "root": "pool"
                                                                },
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "sg n",
                                                                        "partofspeech": "N",
                                                                        "root": "pool"
                                                                },
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "sg n",
                                                                        "partofspeech": "S",
                                                                        "root": "pool"
                                                                }
                                                        ],
                                                        "text": "pool"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "b",
                                                                        "form": "b",
                                                                        "partofspeech": "V",
                                                                        "root": "tule"
                                                                }
                                                        ],
                                                        "text": "tuleb"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "t",
                                                                        "form": "sg p",
                                                                        "partofspeech": "S",
                                                                        "root": "äike"
                                                                },
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "t",
                                                                        "form": "sg p",
                                                                        "partofspeech": "S",
                                                                        "root": "äikene"
                                                                }
                                                        ],
                                                        "text": "äikest."
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "",
                                                                        "partofspeech": "D",
                                                                        "root": "kõikjal"
                                                                }
                                                        ],
                                                        "text": "kõikjal"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "sg n",
                                                                        "partofspeech": "S",
                                                                        "root": "pilvisus"
                                                                }
                                                        ],
                                                        "text": "pilvisus"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "",
                                                                        "partofspeech": "J",
                                                                        "root": "ja"
                                                                }
                                                        ],
                                                        "text": "ja"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "sg n",
                                                                        "partofspeech": "S",
                                                                        "root": "vihma_sadu"
                                                                },
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "sg p",
                                                                        "partofspeech": "S",
                                                                        "root": "vihma_sadu"
                                                                }
                                                        ],
                                                        "text": "vihmasadu"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "b",
                                                                        "form": "b",
                                                                        "partofspeech": "V",
                                                                        "root": "laiene"
                                                                }
                                                        ],
                                                        "text": "laieneb"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "ks",
                                                                        "form": "sg tr",
                                                                        "partofspeech": "S",
                                                                        "root": "õhtu"
                                                                }
                                                        ],
                                                        "text": "õhtuks"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "",
                                                                        "partofspeech": "D",
                                                                        "root": "üle"
                                                                },
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "",
                                                                        "partofspeech": "K",
                                                                        "root": "üle"
                                                                }
                                                        ],
                                                        "text": "üle"
                                                },
                                                {
                                                        "analysis": [
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "sg g",
                                                                        "partofspeech": "H",
                                                                        "root": "Eesti"
                                                                },
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "sg n",
                                                                        "partofspeech": "H",
                                                                        "root": "Eesti"
                                                                },
                                                                {
                                                                        "clitic": "",
                                                                        "ending": "0",
                                                                        "form": "",
                                                                        "partofspeech": "G",
                                                                        "root": "eesti"
                                                                }
                                                        ],
                                                        "text": "Eesti,"
                                                }
                                        ]
                                }
                        ]
                }
        ]
}

Ehk siis: "Homme tiheneb" järele on tõstetud lause lõpp ("mitmel pool tuleb äikest.") ja seejärel tuleb lauseosa "kõikjal pilvisus ja vihmasadu laieneb õhtuks üle Eesti,".

Jääb mulje, nagu oleks sõnade täisarvulised indeksid tehtud stringideks ning sõnad väljastatud string-kujul indeksite järjekorras (st '1' < '10' < '11' < '12' < ... < '19' < '2').

PRR24 commented 10 years ago

Tänan hea detailse kirjelduse eest. Väga rumal viga, nüüd parandatud.