apertium / lttoolbox

Finite state compiler, processor and helper tools used by apertium
http://wiki.apertium.org/wiki/Lttoolbox
GNU General Public License v2.0
18 stars 22 forks source link

added: getopts and more flags #69

Closed singh-lokendra closed 5 years ago

TinoDidriksen commented 5 years ago

Will this (and https://github.com/apertium/apertium/pull/56 and https://github.com/apertium/apertium-lex-tools/pull/28) then require that all calls from Python provide argc and argv? That would be cumbersome - they should be optional.

singh-lokendra commented 5 years ago

This was my line of thought

they should be optional.

sushain97 commented 5 years ago

I'm not actually super concerned with how the swig wrapper/python interface for directly calling this stuff looks since the apertium python package wraps them up nicely anyway. It was a non-goal of this project to make these interfaces nice and usable.

What I'm more concerned with is that we're duplicating a bunch of logic here and just adding code that will get out of sync with the code that actually parses arguments for the CLI binaries. Thoughts?

singh-lokendra commented 5 years ago

What I'm more concerned with is that we're duplicating a bunch of logic here and just adding code that will get out of sync with the code that actually parses arguments for the CLI binaries. Thoughts?

Below is the list of various arguments used in mode files, Since these flags did required wrapping and ftyres didn't had all the pairs at that moment, I wrapped all of the arguments : ) https://github.com/apertium/apertium-python/issues/48

lt-proc 
-b -c -d -e -p -w -x

lrx-proc
-m -t

apertium-interchunk
'', -t

apertium-postchunk
''

apertium-pretransfer
''

apertium-tagger
-g -p -u 2

apertium-transfer
-b -n -t

cg-proc
'' -n -w -1
TinoDidriksen commented 5 years ago

Duplicated logic is also a concern. It is absolutely possible to refactor the C++ code so that getopt() and other option parsing is done in a shared 3rd function that Python can also make use of. But if that's too much work right now, it can be done later.

sushain97 commented 5 years ago

I feel OK merging this since the amount of duplicated code seems pretty small.