Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
build_knowledge : clear graph db before move on
Browse files Browse the repository at this point in the history
  • Loading branch information
tao-pr authored and starcolon committed Feb 14, 2017
1 parent 5b137eb commit 42910d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ Execute:
```

The script continuously and endlessly crawls the knowledge topic
from Wikipedia starting from `Jupiter` page. You may change
from Wikipedia starting from the seeding page. You may change
the initial topic within the script to what best suits you.
To stop the process, just terminate is fine. It won't leave
anything at dirty state.
anything at dirty stat so you can re-execute the script again
at any time.

>**[NOTE]** The script keeps continuously crawling
and downloading the related knowledge through link traveral.
Expand Down
1 change: 1 addition & 0 deletions build_knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def iter_topic(crawl_collection,start):
# Initialise a knowledge database
print(colored('Initialising knowledge graph database...','cyan'))
kb = Knowledge('localhost','vor','root',args['root'])
kb.clear()

# Load existing pos patterns
print(colored('Loading POS patterns...','cyan'))
Expand Down
8 changes: 8 additions & 0 deletions pylib/knowledge/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def __prepare_classes(self):
print(colored(e,'yellow'))


"""
Permanently remove all edges and vertices
"""
def clear(self):
self.orient.command('delete vertex TOPIC')
self.orient.command('delete vertex KEYWORD')
self.orient.command('delete edge') # May this be redundant?
print(colored('[Graph clearance] done','yellow'))

"""
Add a set of new knowledge links
Expand Down

0 comments on commit 42910d5

Please sign in to comment.