Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
faes
asm
Commits
cf10b113
Commit
cf10b113
authored
Oct 30, 2017
by
JR
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes for tokenizer in trie building.
parent
97e88225
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
IMGazetteer/src/br/ufpr/inf/junior/imgazetteer/InexactGazetteer.java
.../src/br/ufpr/inf/junior/imgazetteer/InexactGazetteer.java
+6
-6
IMGazetteer/src/br/ufpr/inf/junior/utils/TrieUtil.java
IMGazetteer/src/br/ufpr/inf/junior/utils/TrieUtil.java
+2
-2
No files found.
IMGazetteer/src/br/ufpr/inf/junior/imgazetteer/InexactGazetteer.java
View file @
cf10b113
...
...
@@ -406,7 +406,7 @@ public class InexactGazetteer extends AbstractLanguageAnalyser implements Action
protected
void
loadDataFromDictionary
()
throws
Exception
{
if
(
getConfigFileURL
()
!=
null
)
{
List
<
String
>
gazetteerEntriesList
=
new
ArrayList
<>();
//
List<String> gazetteerEntriesList = new ArrayList<>();
logger
.
info
(
"Creating trie from "
+
getConfigFileURL
());
BufferedReader
dictionaryBuffReader
=
new
BomStrippingInputStreamReader
((
configFileURL
).
openStream
(),
encoding
);
...
...
@@ -503,7 +503,7 @@ public class InexactGazetteer extends AbstractLanguageAnalyser implements Action
this
.
gazetteerFeaturesMap
=
makeTrie
.
loadEntriesAndFeatures
(
configFileURL
,
this
.
entrieDelimiter
,
this
.
featureNameValueSeparator
,
this
.
featuresSeparator
,
encoding
);
HashMap
<
Integer
,
Integer
>
tamanhoLinha
Map
=
new
HashMap
<>();
HashMap
<
Integer
,
Integer
>
entrieLineLength
Map
=
new
HashMap
<>();
Integer
linhaCount
=
0
;
File
configFile
=
gate
.
util
.
Files
.
fileFromURL
(
configFileURL
);
String
entriesFileName
=
configFile
.
getAbsolutePath
().
replaceAll
(
"\\.txt$"
,
"\\_GAZETTEERS.txt"
);
...
...
@@ -512,16 +512,16 @@ public class InexactGazetteer extends AbstractLanguageAnalyser implements Action
linhaCount
++;
String
entrieNormalized
=
element
.
getKey
().
trim
();
entrieNormalized
=
ws_pattern
.
matcher
(
entrieNormalized
).
replaceAll
(
" "
);
gazetteerEntriesList
.
add
(
entrieNormalized
);
tamanhoLinha
Map
.
put
(
linhaCount
,
entrieNormalized
.
length
());
//
gazetteerEntriesList.add(entrieNormalized);
entrieLineLength
Map
.
put
(
linhaCount
,
entrieNormalized
.
length
());
writer
.
println
(
entrieNormalized
);
}
writer
.
close
();
// Build trie
this
.
trie
=
new
NodeFT
(
null
,
Boolean
.
FALSE
,
new
ArrayList
<>(),
0
);
this
.
trie
=
new
TrieUtil
().
buildTrie
(
gazetteerEntriesList
,
trie
,
this
.
useTransformation
,
encoding
,
this
.
transformationClass
,
this
.
transformationMethod
,
entriesFileName
,
tamanhoLinha
Map
,
this
.
trie
=
new
TrieUtil
().
buildTrie
(
trie
,
this
.
useTransformation
,
encoding
,
this
.
transformationClass
,
this
.
transformationMethod
,
entriesFileName
,
entrieLineLength
Map
,
this
.
tokeniserGatePR
);
this
.
deepestLevel
=
trie
.
getLevel
();
this
.
trie
.
setLevel
(
0
);
...
...
IMGazetteer/src/br/ufpr/inf/junior/utils/TrieUtil.java
View file @
cf10b113
...
...
@@ -72,7 +72,7 @@ public class TrieUtil {
* @return NodeFT
* @throws Exception
*/
public
NodeFT
buildTrie
(
List
<
String
>
gazetteerList
,
NodeFT
root
,
boolean
useTransformation
,
String
encoding
,
public
NodeFT
buildTrie
(
NodeFT
root
,
boolean
useTransformation
,
String
encoding
,
String
transformationClass
,
String
transformationMethod
,
String
entriesFilePath
,
HashMap
<
Integer
,
Integer
>
tamanhoLinhaMap
,
String
tokeniserPR
)
throws
Exception
{
int
deepestLevel
=
0
;
...
...
@@ -208,7 +208,7 @@ public class TrieUtil {
}
root
.
setLevel
(
deepestLevel
);
logger
.
info
(
"Number of entries: "
+
gazetteerList
.
size
()
);
logger
.
info
(
"Number of entries: "
+
lineCount
);
logger
.
info
(
"Number of characters: "
+
numberChars
);
logger
.
info
(
"Number of nodes: "
+
totalNos
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment