Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
anuvaad
OpenNMT-py
Commits
203b54aa
Commit
203b54aa
authored
4 years ago
by
aj7tesh
Browse files
Options
Download
Patches
Plain Diff
handled unk token while decoding
parent
6c5250fe
master
dependabot/pip/flask-cors-3.0.9
experiments
release_anuvaad
release_anuvaad_users
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ancillary_functions_anuvaad/output_cleaner.py
+2
-0
ancillary_functions_anuvaad/output_cleaner.py
tools/sp_enc_dec.py
+1
-1
tools/sp_enc_dec.py
with
3 additions
and
1 deletion
+3
-1
ancillary_functions_anuvaad/output_cleaner.py
+
2
−
0
View file @
203b54aa
...
...
@@ -16,6 +16,8 @@ def purnaviram_applier(src,tgt):
For english to hindi translation
'''
try
:
if
tgt
is
None
or
len
(
tgt
.
split
())
==
0
:
return
tgt
if
len
(
src
.
split
())
<
5
:
return
tgt
if
src
.
endswith
(
'.'
)
and
tgt
.
endswith
(
'।'
):
...
...
This diff is collapsed.
Click to expand it.
tools/sp_enc_dec.py
+
1
−
1
View file @
203b54aa
...
...
@@ -97,7 +97,7 @@ def decode_line(load_model,line):
line
=
line
[
0
]
+
line
[
1
:
-
1
].
replace
(
']'
,
""
)
+
line
[
-
1
]
logger
.
info
(
"decoding using sp model {}"
.
format
(
load_model
))
if
"<unk>"
in
line
:
line
=
line
.
replace
(
"<unk>"
,
"
'<unk>'
"
)
line
=
line
.
replace
(
"<unk>"
,
""
)
return
sp
.
DecodePieces
(
eval
(
line
))
except
Exception
as
e
:
logger
.
error
(
"something went wrong! {}"
.
format
(
e
))
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets