-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kalmyk paresr implementation -- ispras/lingvodoc-react#1119 (#1503)
* use postgres:ready if is * fix * image: 'docker_api:latest' * fix * dirty fix * docker.ini.template * minor * PGDATA * added hfst parser * added hfst parser * pretty output * correct output * lib * file dynamical name * fix * fix * More correct translation * Fix * Revert "Fix" This reverts commit 6150886. * Fix * /opt/hfst * moved * fixed requirement * docker-compose-proxy.yml * Cleanup * Catch when no gloss * Indicate markups with 'gr: Unknown' in any proposed variants with yellow color on OdtMarkupModal/PropertiesView * fix
- Loading branch information
Showing
11 changed files
with
26,394 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Kalmyk parser added | ||
Revision ID: 0fc45203d6ab | ||
Revises: 6e02e6fdf0f9 | ||
Create Date: 2024-01-11 12:20:38.119574 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '0fc45203d6ab' | ||
down_revision = '6e02e6fdf0f9' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
from alembic import op | ||
|
||
def upgrade(): | ||
op.execute(''' | ||
INSERT INTO public.parser(additional_metadata, created_at, object_id, client_id, name, parameters, method) | ||
VALUES(null, '2024-01-11 12:20:38', 12, 1, 'Парсер калмыцкого языка (hfst)', '[]', | ||
'hfst_kalmyk'); | ||
''') | ||
|
||
def downgrade(): | ||
op.execute(''' | ||
DELETE FROM parser WHERE method = 'hfst_kalmyk'; | ||
''') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/python3 | ||
from hfst_dev import compile_xfst_file | ||
import cgi | ||
import cgitb | ||
import shutil | ||
|
||
STACK_FILENAME = 'rules.xfst.hfst' | ||
DIR = '/var/www/cgi-bin/xal/' | ||
TMP = '/var/www/tmp/' | ||
|
||
cgitb.enable(format='text') | ||
POST = cgi.FieldStorage() | ||
|
||
print('Content-Type: text/html; charset=utf-8') | ||
print('') | ||
|
||
try: | ||
LF = POST['LEXC'].filename | ||
RF = POST['RULES'].filename | ||
except: | ||
LF = '' | ||
RF = '' | ||
if LF != '' and RF != '': | ||
LexcFile = open(TMP + POST['LEXC'].filename, 'wb') | ||
LexcFile.write(POST['LEXC'].file.read()) | ||
LexcFile.flush() | ||
LexcFile.close() | ||
RulesFile = open(TMP + POST['RULES'].filename, 'wb') | ||
RulesFile.write(POST['RULES'].file.read()) | ||
RulesFile.flush() | ||
RulesFile.close() | ||
RulesFile = open(TMP + POST['RULES'].filename, 'a+') | ||
RulesFile.write('\nsave stack ' + STACK_FILENAME) | ||
RulesFile.flush() | ||
RulesFile.close() | ||
shutil.copyfile(TMP + POST['LEXC'].filename, DIR + POST['LEXC'].filename) | ||
shutil.copyfile(TMP + POST['RULES'].filename, DIR + POST['RULES'].filename) | ||
compile_xfst_file(DIR + POST['RULES'].filename) | ||
print('XFST compiled!') | ||
else: | ||
print(''' | ||
<form method="post" enctype="multipart/form-data"> | ||
<input type="file" name="LEXC"><br/> | ||
<input type="file" name="RULES"><br/> | ||
<input type="submit" value="COMPILE!"> | ||
</form> | ||
''') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25,882 changes: 25,882 additions & 0 deletions
25,882
lingvodoc/static/parsers/hfst/xal/lexicon.lexc
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters