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
3b565087
Commit
3b565087
authored
Sep 02, 2015
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Configuring Melt but still with bugs.
parent
88a82af8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
FrenchNgramsExtractor.py
parsing/NgramsExtractors/FrenchNgramsExtractor.py
+3
-3
NgramsExtractor.py
parsing/NgramsExtractors/NgramsExtractor.py
+6
-6
__init__.py
parsing/NgramsExtractors/__init__.py
+2
-2
No files found.
parsing/NgramsExtractors/FrenchNgramsExtractor.py
View file @
3b565087
from
.NgramsExtractor
import
NgramsExtractor
from
.NgramsExtractor
import
NgramsExtractor
from
..Taggers
import
TreeTagger
from
..Taggers
import
TreeTagger
,
MeltTagger
class
FrenchNgramsExtractor
(
NgramsExtractor
):
class
FrenchNgramsExtractor
(
NgramsExtractor
):
def
start
(
self
):
def
start
(
self
):
self
.
tagger
=
TreeTagger
()
#
self.tagger = TreeTagger()
#
self.tagger = MeltTagger(language='fr')
self
.
tagger
=
MeltTagger
(
language
=
'fr'
)
parsing/NgramsExtractors/NgramsExtractor.py
View file @
3b565087
...
@@ -14,22 +14,22 @@ class NgramsExtractor:
...
@@ -14,22 +14,22 @@ class NgramsExtractor:
self
.
_label
=
"NP"
self
.
_label
=
"NP"
self
.
_rule
=
self
.
_label
+
": "
+
rule
self
.
_rule
=
self
.
_label
+
": "
+
rule
self
.
_grammar
=
nltk
.
RegexpParser
(
self
.
_rule
)
self
.
_grammar
=
nltk
.
RegexpParser
(
self
.
_rule
)
def
__del__
(
self
):
def
__del__
(
self
):
self
.
stop
()
self
.
stop
()
def
start
(
self
):
def
start
(
self
):
self
.
tagger
=
TurboTagger
()
self
.
tagger
=
TurboTagger
()
def
stop
(
self
):
def
stop
(
self
):
pass
pass
"""Extracts a list of ngrams.
"""Extracts a list of ngrams.
Returns a list of the ngrams found in the given text.
Returns a list of the ngrams found in the given text.
"""
"""
def
extract_ngrams
(
self
,
contents
):
def
extract_ngrams
(
self
,
contents
):
tagged_ngrams
=
self
.
tagger
.
tag_text
(
contents
)
tagged_ngrams
=
list
(
self
.
tagger
.
tag_text
(
contents
)
)
if
len
(
tagged_ngrams
):
if
len
(
tagged_ngrams
):
grammar_parsed
=
self
.
_grammar
.
parse
(
tagged_ngrams
)
grammar_parsed
=
self
.
_grammar
.
parse
(
tagged_ngrams
)
for
subtree
in
grammar_parsed
.
subtrees
():
for
subtree
in
grammar_parsed
.
subtrees
():
...
...
parsing/NgramsExtractors/__init__.py
View file @
3b565087
from
.FrenchNgramsExtractor
import
FrenchNgramsExtractor
from
.FrenchNgramsExtractor
import
FrenchNgramsExtractor
from
.TurboNgramsExtractor
import
TurboNgramsExtractor
as
EnglishNgramsExtractor
#
from .TurboNgramsExtractor import TurboNgramsExtractor as EnglishNgramsExtractor
#
from .EnglishNgramsExtractor import EnglishNgramsExtractor
from
.EnglishNgramsExtractor
import
EnglishNgramsExtractor
from
.NgramsExtractor
import
NgramsExtractor
from
.NgramsExtractor
import
NgramsExtractor
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