Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
26410ad9
Commit
26410ad9
authored
Oct 20, 2014
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding words to pythonic charabia ;)
parent
67adabac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
FileParser.py
mat-parsing/FileParsers/FileParser.py
+4
-4
No files found.
mat-parsing/FileParsers/FileParser.py
View file @
26410ad9
...
@@ -6,7 +6,7 @@ import collections
...
@@ -6,7 +6,7 @@ import collections
class
NgramCache
:
class
NgramCache
:
def
__init__
(
self
,
language
):
def
__init__
(
self
,
language
):
self
.
_cache
=
{}
self
.
_cache
=
dict
()
self
.
_language
=
language
self
.
_language
=
language
def
__getitem__
(
self
,
terms
):
def
__getitem__
(
self
,
terms
):
...
@@ -34,7 +34,7 @@ class FileParser:
...
@@ -34,7 +34,7 @@ class FileParser:
# cache for ngrams
# cache for ngrams
self
.
_ngramcaches
=
collections
.
defaultdicts
(
NgramCache
)
self
.
_ngramcaches
=
collections
.
defaultdicts
(
NgramCache
)
# extractors
# extractors
self
.
_extractors
=
{}
self
.
_extractors
=
dict
()
self
.
_document_nodetype
=
NodeType
.
get
(
label
=
'document'
)
self
.
_document_nodetype
=
NodeType
.
get
(
label
=
'document'
)
with
Language
.
objects
.
all
()
as
languages
:
with
Language
.
objects
.
all
()
as
languages
:
self
.
_languages_iso2
=
{
language
.
iso2
.
lower
():
language
for
language
in
Language
}
self
.
_languages_iso2
=
{
language
.
iso2
.
lower
():
language
for
language
in
Language
}
...
@@ -61,7 +61,7 @@ class FileParser:
...
@@ -61,7 +61,7 @@ class FileParser:
[
token
for
token
,
tag
in
extractor
.
extract_ngrams
(
text
)]
[
token
for
token
,
tag
in
extractor
.
extract_ngrams
(
text
)]
)
)
else
:
else
:
return
{}
return
dict
()
"""Add a document to the database.
"""Add a document to the database.
"""
"""
...
@@ -115,5 +115,5 @@ class FileParser:
...
@@ -115,5 +115,5 @@ class FileParser:
This method shall be overriden by inherited classes.
This method shall be overriden by inherited classes.
"""
"""
def
parse
(
self
):
def
parse
(
self
):
return
[]
return
list
()
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