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
d6dbafd9
Commit
d6dbafd9
authored
Mar 25, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Init files.
parent
db11c58f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
116 deletions
+55
-116
init.py
init/init.py
+13
-6
part_of_speech_labels.py
init/part_of_speech_labels.py
+1
-1
init_gargantext.py
init_gargantext.py
+41
-109
No files found.
init/init.py
View file @
d6dbafd9
...
@@ -135,13 +135,7 @@ except Exception as error:
...
@@ -135,13 +135,7 @@ except Exception as error:
#Node.objects.all().delete()
#Node.objects.all().delete()
# In[9]:
try
:
project
=
Node
.
objects
.
get
(
name
=
'Bees project'
)
except
:
project
=
Node
(
name
=
'Bees project'
,
type
=
typeProject
,
user
=
me
)
project
.
save
()
try
:
try
:
stem
=
Node
.
objects
.
get
(
name
=
'Stem'
)
stem
=
Node
.
objects
.
get
(
name
=
'Stem'
)
...
@@ -153,3 +147,16 @@ except:
...
@@ -153,3 +147,16 @@ except:
from
gargantext_web.db
import
*
# Instantiante table NgramTag:
f
=
open
(
"part_of_speech_labels.txt"
,
'r'
)
for
line
in
f
.
readlines
():
name
,
description
=
line
.
strip
()
.
split
(
'
\t
'
)
_tag
=
Tag
(
name
=
name
,
description
=
description
)
session
.
add
(
_tag
)
session
.
commit
()
f
.
close
()
init/part_of_speech_labels.py
View file @
d6dbafd9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
from
gargantext_web.db
import
*
from
gargantext_web.db
import
*
# Instantiante table NgramTag:
# Instantiante table NgramTag:
f
=
open
(
"
/srv/gargantext/init/
part_of_speech_labels.txt"
,
'r'
)
f
=
open
(
"part_of_speech_labels.txt"
,
'r'
)
for
line
in
f
.
readlines
():
for
line
in
f
.
readlines
():
name
,
description
=
line
.
strip
()
.
split
(
'
\t
'
)
name
,
description
=
line
.
strip
()
.
split
(
'
\t
'
)
...
...
init_gargantext.py
View file @
d6dbafd9
...
@@ -77,112 +77,27 @@ except:
...
@@ -77,112 +77,27 @@ except:
print
(
'Initialize node types...'
)
print
(
'Initialize node types...'
)
try
:
node_types
=
[
typeProject
=
NodeType
.
objects
.
get
(
name
=
'Root'
)
'Root'
,
'Trash'
,
except
Exception
as
error
:
'Project'
,
'Corpus'
,
'Document'
,
print
(
error
)
'Stem'
,
'Lem'
,
'Tfidf'
,
typeProject
=
NodeType
(
name
=
'Root'
)
'Synonym'
,
typeProject
.
save
()
'MiamList'
,
'StopList'
,
'Cooccurrence'
,
try
:
]
typeProject
=
NodeType
.
objects
.
get
(
name
=
'Project'
)
except
Exception
as
error
:
for
node_type
in
node_types
:
print
(
error
)
NodeType
.
objects
.
get_or_create
(
name
=
node_type
)
typeProject
=
NodeType
(
name
=
'Project'
)
typeProject
.
save
()
try
:
typeCorpus
=
NodeType
.
objects
.
get
(
name
=
'Corpus'
)
except
Exception
as
error
:
print
(
error
)
typeCorpus
=
NodeType
(
name
=
'Corpus'
)
typeCorpus
.
save
()
try
:
typeDoc
=
NodeType
.
objects
.
get
(
name
=
'Document'
)
except
Exception
as
error
:
print
(
error
)
typeDoc
=
NodeType
(
name
=
'Document'
)
typeDoc
.
save
()
try
:
typeStem
=
NodeType
.
objects
.
get
(
name
=
'Stem'
)
except
Exception
as
error
:
print
(
error
)
typeStem
=
NodeType
(
name
=
'Stem'
)
typeStem
.
save
()
try
:
typeTfidf
=
NodeType
.
objects
.
get
(
name
=
'Tfidf'
)
except
Exception
as
error
:
print
(
error
)
typeTfidf
=
NodeType
(
name
=
'Tfidf'
)
typeTfidf
.
save
()
try
:
typeDoc
=
NodeType
.
objects
.
get
(
name
=
'WhiteList'
)
except
Exception
as
error
:
print
(
error
)
typeDoc
=
NodeType
(
name
=
'WhiteList'
)
typeDoc
.
save
()
try
:
typeDoc
=
NodeType
.
objects
.
get
(
name
=
'BlackList'
)
except
Exception
as
error
:
print
(
error
)
typeDoc
=
NodeType
(
name
=
'BlackList'
)
typeDoc
.
save
()
try
:
typeDoc
=
NodeType
.
objects
.
get
(
name
=
'Synonyme'
)
except
Exception
as
error
:
print
(
error
)
typeDoc
=
NodeType
(
name
=
'Synonyme'
)
typeDoc
.
save
()
try
:
typeDoc
=
NodeType
.
objects
.
get
(
name
=
'Cooccurrence'
)
except
Exception
as
error
:
print
(
error
)
typeDoc
=
NodeType
(
name
=
'Cooccurrence'
)
typeDoc
.
save
()
# Integration: resource types
# Integration: resource types
print
(
'Initialize resource...'
)
print
(
'Initialize resource...'
)
try
:
typePubmed
=
ResourceType
.
objects
.
get
(
name
=
'pubmed'
)
resources
=
[
typeIsi
=
ResourceType
.
objects
.
get
(
name
=
'isi'
)
'pubmed'
,
'isi'
,
'ris'
,
'europress_french'
,
'europress_english'
]
typeRis
=
ResourceType
.
objects
.
get
(
name
=
'ris'
)
typePresseFr
=
ResourceType
.
objects
.
get
(
name
=
'europress_french'
)
for
resource
in
resources
:
typePresseEn
=
ResourceType
.
objects
.
get
(
name
=
'europress_english'
)
NodeType
.
objects
.
get_or_create
(
name
=
resource
)
except
Exception
as
error
:
print
(
error
)
typePubmed
=
ResourceType
(
name
=
'pubmed'
)
typePubmed
.
save
()
typeIsi
=
ResourceType
(
name
=
'isi'
)
typeIsi
.
save
()
typeRis
=
ResourceType
(
name
=
'ris'
)
typeRis
.
save
()
typePresseFr
=
ResourceType
(
name
=
'europress_french'
)
typePresseFr
.
save
()
typePresseEn
=
ResourceType
(
name
=
'europress_english'
)
typePresseEn
.
save
()
# Integration Node Stem
try
:
stem
=
Node
.
objects
.
get
(
name
=
'Stem'
)
except
:
stem
=
Node
(
name
=
'Stem'
,
type
=
typeStem
,
user
=
me
)
stem
.
save
()
...
@@ -198,13 +113,13 @@ except:
...
@@ -198,13 +113,13 @@ except:
# Integration: corpus
# Integration: corpus
print
(
'Initialize corpus...'
)
#
print('Initialize corpus...')
try
:
#
try:
corpus_pubmed
=
Node
.
objects
.
get
(
name
=
'PubMed corpus'
)
#
corpus_pubmed = Node.objects.get(name='PubMed corpus')
except
:
#
except:
corpus_pubmed
=
Node
(
parent
=
project
,
name
=
'PubMed corpus'
,
type
=
typeCorpus
,
user
=
me
)
#
corpus_pubmed = Node(parent=project, name='PubMed corpus', type=typeCorpus, user=me)
corpus_pubmed
.
save
()
#
corpus_pubmed.save()
#
#print('Initialize resource...')
#print('Initialize resource...')
#corpus_pubmed.add_resource(
#corpus_pubmed.add_resource(
# # file='./data_samples/pubmed.zip',
# # file='./data_samples/pubmed.zip',
...
@@ -223,4 +138,21 @@ except:
...
@@ -223,4 +138,21 @@ except:
# corpus_pubmed.children.all().extract_ngrams(['title',])
# corpus_pubmed.children.all().extract_ngrams(['title',])
# print('Parsed corpus #%d.' % (corpus_pubmed.id, ))
# print('Parsed corpus #%d.' % (corpus_pubmed.id, ))
from
gargantext_web.db
import
*
# Instantiante table NgramTag:
f
=
open
(
"part_of_speech_labels.txt"
,
'r'
)
for
line
in
f
.
readlines
():
name
,
description
=
line
.
strip
()
.
split
(
'
\t
'
)
_tag
=
Tag
(
name
=
name
,
description
=
description
)
session
.
add
(
_tag
)
session
.
commit
()
f
.
close
()
exit
()
exit
()
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