Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
speller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nlpworkers
speller
Merge requests
!6
Develop
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Develop
develop
into
master
Overview
0
Commits
39
Pipelines
2
Changes
5
Merged
Develop
Ghost User
requested to merge
develop
into
master
Aug 31, 2020
Overview
0
Commits
39
Pipelines
2
Changes
5
0
0
Merge request reports
Compare
master
version 1
c52d0c77
Aug 31, 2020
master (base)
and
latest version
latest version
f87a44f1
39 commits,
Aug 31, 2020
version 1
c52d0c77
38 commits,
Aug 31, 2020
5 files
+
28
−
25
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
module/src/main/java/pl/clarin/speller/SpaCy.java
+
14
−
12
View file @ f87a44f1
Edit in single-file editor
Open in Web IDE
Show full file
@@ -61,11 +61,13 @@ public class SpaCy {
ArrayList
<
ArrayList
<
Integer
>>
array
=
new
ArrayList
<>();
try
{
while
((
line
=
reader
.
readLine
())
!=
null
)
{
String
[]
str
=
line
.
split
(
" "
);
ArrayList
<
Integer
>
list
=
new
ArrayList
<>();
list
.
add
(
Integer
.
parseInt
(
str
[
0
]));
list
.
add
(
Integer
.
parseInt
(
str
[
1
]));
array
.
add
(
list
);
if
(!
line
.
equals
(
""
))
{
String
[]
str
=
line
.
split
(
" "
);
ArrayList
<
Integer
>
list
=
new
ArrayList
<>();
list
.
add
(
Integer
.
parseInt
(
str
[
0
]));
list
.
add
(
Integer
.
parseInt
(
str
[
1
]));
array
.
add
(
list
);
}
}
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"The text file contains incorrect data."
+
e
.
getMessage
());
@@ -74,14 +76,14 @@ public class SpaCy {
}
/**Checks if input sentence is from a different language.*/
public
boolean
isForeignSentence
(
String
inputString
,
int
matchFrom
)
{
public
boolean
isForeignSentence
(
String
inputString
,
int
idx
,
int
matchFrom
)
{
boolean
isForeginSent
=
false
;
if
(
loaded
)
{
for
(
List
<
Integer
>
tuple
:
foreignSentenceArray
)
{
if
(
matchFrom
>=
tuple
.
get
(
0
)
&&
matchFrom
<
tuple
.
get
(
1
))
{
return
Character
.
isUpperCase
(
inputString
.
charAt
(
matchFrom
))
;
if
(
matchFrom
>=
(
tuple
.
get
(
0
)
-
idx
)
&&
matchFrom
<
(
tuple
.
get
(
1
)
-
idx
)
)
{
return
true
;
}
if
(
matchFrom
>
tuple
.
get
(
1
)
)
{
if
(
(
tuple
.
get
(
1
)
-
idx
)
>
matchFrom
)
{
return
false
;
}
}
@@ -90,7 +92,7 @@ public class SpaCy {
}
/**Checks if input sentence is from a proper noun.*/
public
boolean
isProperNoun
(
String
inputString
,
int
matchFrom
)
{
public
boolean
isProperNoun
(
String
inputString
,
int
idx
,
int
matchFrom
)
{
boolean
isProperNoun
=
false
;
if
(!
loaded
)
{
if
(
Character
.
isUpperCase
(
inputString
.
charAt
(
matchFrom
)))
{
@@ -107,10 +109,10 @@ public class SpaCy {
}
}
else
{
for
(
List
<
Integer
>
tuple
:
properNounArray
)
{
if
(
matchFrom
>=
tuple
.
get
(
0
)
&&
matchFrom
<
tuple
.
get
(
1
))
{
if
(
matchFrom
>=
(
tuple
.
get
(
0
)
-
idx
)
&&
matchFrom
<
(
tuple
.
get
(
1
)
-
idx
)
)
{
return
Character
.
isUpperCase
(
inputString
.
charAt
(
matchFrom
));
}
if
(
matchFrom
>
tuple
.
get
(
1
)
)
{
if
(
(
tuple
.
get
(
1
)
-
idx
)
>
matchFrom
)
{
return
false
;
}
}
Loading