parolteknologio / EsperantoGPT

Esperanto language expert and instructor for ChatGPT and other systems
https://chat.openai.com/g/g-D4jB3Ml4b-esperanto-helpanto
26 stars 3 forks source link

Experiment with python spell checker #4

Open stefangrotz opened 7 months ago

stefangrotz commented 7 months ago

For example https://pypi.org/project/literumilo/ could be run inside the chat to double check things.

Test1:

grafik

Prompt:

Use the code interpreter to check Esperanto spelling like this:

import literumilo

Using the above method, literumilo's functions must be prefixed with the package name, as below:

result = literumilo.check_word("ĉirkaŭiris")

Alternatively, you can import the function names directly:

from literumilo import x_to_accent
from literumilo import check_word
from literumilo import analyze_string
from literumilo import analyze_file

The code samples below assume that the second method has been used:

analyze_string

This function has two modes, morpheme mode and spell checker mode. The first parameter is the string to analyze. The second is the mode. When the mode is True, analyze_string will divide every Esperanto word in the string into morphemes, and return the new string. For example:

TEXT = "Birdoj (Aves) estas klaso de vertebruloj kun ĉirkaŭ 9 ĝis 10 mil vivantaj specioj."
result = analyze_string(TEXT, True)
print(result)

The above will print out

Bird.oj (Aves) est.as klas.o de vertebr.ul.oj kun ĉirkaŭ 9 ĝis 10 mil viv.ant.aj speci.oj

When the morpheme mode is False, analyze_string outputs a list of unknown words. This code,

TEXT = "Birdoj (Aves) estas klaso de vertebruloj kun ĉirkaŭ 9 ĝis 10 mil vivantaj specioj."
result = analyze_string(TEXT, False)
print(result)
stefangrotz commented 7 months ago

It is possible to upload literumilo-1.0.8-py3-none-any.whl and install it:

image

This should also be possible as a user file, but takes a lot of time.