Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
predict-lang
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EmoTeam
multiemo-results-presentation
predict-lang
Commits
5f8fd8b7
Commit
5f8fd8b7
authored
4 years ago
by
Bartłomiej Bojanowski
Browse files
Options
Downloads
Patches
Plain Diff
Fix pep8 format
parent
fe5bca06
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!2
Developer
,
!1
Feature 257
Pipeline
#1826
passed with stage
in 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/predict_lang.py
+6
-4
6 additions, 4 deletions
src/predict_lang.py
with
6 additions
and
4 deletions
src/predict_lang.py
+
6
−
4
View file @
5f8fd8b7
import
fasttext
import
fasttext
import
nlp_ws
import
nlp_ws
class
PredictLangWorker
(
nlp_ws
.
NLPWorker
):
class
PredictLangWorker
(
nlp_ws
.
NLPWorker
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
model
=
fasttext
.
load_model
(
"
lid.176.bin
"
)
self
.
model
=
fasttext
.
load_model
(
"
lid.176.bin
"
)
def
process
(
self
,
input_file
:
str
,
task_options
:
dict
,
output_file
:
str
)
->
None
:
def
process
(
self
,
input_file
:
str
,
task_options
:
dict
,
output_file
:
str
)
->
None
:
with
open
(
input_file
,
"
r
"
)
as
f
:
with
open
(
input_file
,
"
r
"
)
as
f
:
text
=
f
.
read
().
replace
(
'
\n
'
,
'
'
)
text
=
f
.
read
().
replace
(
'
\n
'
,
'
'
)
print
(
text
)
predict
=
self
.
model
.
predict
(
text
)[
0
][
0
]
predict
=
self
.
model
.
predict
(
text
)[
0
][
0
]
with
open
(
output_file
,
"
w
"
)
as
f
:
with
open
(
output_file
,
"
w
"
)
as
f
:
f
.
write
(
predict
)
f
.
write
(
predict
)
...
...
This diff is collapsed.
Click to expand it.
Preview
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