Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Macao Legacy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
MACAO
Macao Legacy
Commits
33f0e18c
Commit
33f0e18c
authored
May 27, 2024
by
Eliott Sammier
Browse files
Options
Downloads
Patches
Plain Diff
Comments are now added to RDF graph
parent
fd18fec7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Basilisk/MACAO/macao_12/extracted/extract.py
+1
-1
1 addition, 1 deletion
Basilisk/MACAO/macao_12/extracted/extract.py
Basilisk/MACAO/macao_12/extracted/extract_page.py
+5
-1
5 additions, 1 deletion
Basilisk/MACAO/macao_12/extracted/extract_page.py
with
6 additions
and
2 deletions
Basilisk/MACAO/macao_12/extracted/extract.py
+
1
−
1
View file @
33f0e18c
...
...
@@ -116,7 +116,7 @@ def parse_manifest_rec(
def
main
():
g
=
create_graph
()
extract_page
.
parse_page
(
SOURCE_DIR
+
"
/contenu/pages/pg
60
.html
"
,
"
pg
60
"
)
extract_page
.
parse_page
(
g
,
SOURCE_DIR
+
"
/contenu/pages/pg
112
.html
"
,
"
pg
112
"
)
parse_manifest
(
g
)
export_graph
(
g
)
...
...
This diff is collapsed.
Click to expand it.
Basilisk/MACAO/macao_12/extracted/extract_page.py
+
5
−
1
View file @
33f0e18c
...
...
@@ -3,6 +3,7 @@ from pprint import pprint
from
typing
import
List
from
lxml
import
html
from
rdflib
import
Graph
,
Literal
from
constants
import
*
...
...
@@ -37,7 +38,7 @@ class Page:
regex_comment
=
re
.
compile
(
r
"
(\D*)(\d*)
"
)
def
parse_page
(
filepath
:
str
,
id
:
str
):
def
parse_page
(
graph
:
Graph
,
filepath
:
str
,
id
:
str
):
page
=
Page
()
# Parse with lxml
tree
=
html
.
parse
(
filepath
)
...
...
@@ -58,13 +59,16 @@ def parse_page(filepath: str, id: str):
print
(
f
"
Comment, num=
{
num
}
"
)
comment
.
num
=
int
(
num
)
page
.
comments_misc
.
append
(
comment
)
graph
.
add
((
NS
[
id
],
NS
[
"
commentaireInfo
"
],
Literal
(
comment
.
text
)))
case
[
"
divSugg
"
,
num
]:
print
(
f
"
Suggestion, num=
{
num
}
"
)
comment
.
num
=
int
(
num
)
page
.
comments_sugg
.
append
(
comment
)
graph
.
add
((
NS
[
id
],
NS
[
"
commentaireSugg
"
],
Literal
(
comment
.
text
)))
case
[
"
divCmtSucces
"
,
_
]:
print
(
f
"
Succès
"
)
page
.
comment_success
=
comment
graph
.
add
((
NS
[
id
],
NS
[
"
commentaireSucces
"
],
Literal
(
comment
.
text
)))
case
[
other
,
_
]:
print
(
f
"
other:
{
other
}
"
)
pprint
(
page
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment