Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ww #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

ww #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions KNN_predict/neo_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
from py2neo import Graph,Node,Relationship
from read_csv import readCSV2
from hudong_class import HudongItem

import configparser
class Neo4j():
graph = None
def __init__(self):
print("create neo4j class ...")

def connectDB(self):
self.graph = Graph("http://localhost:7474", username="neo4j", password="8313178")
conf = configparser.ConfigParser()
conf.read('demo/neo4jconfig')
url = conf.get("neo4jdb", "url")
username = conf.get("neo4jdb", "username")
password = conf.get("neo4jdb", "password")
self.graph = Graph(url, username=username, password=password)
# self.graph = Graph("http://localhost:7474", username="neo4j", password="abc123")

def matchItembyTitle(self,value):
answer = self.graph.find_one(label="Item",property_key="title",property_value=value)
Expand Down
9 changes: 7 additions & 2 deletions demo/Model/neo_models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from py2neo import Graph,Node,Relationship
import configparser

class Neo4j():
graph = None
def __init__(self):
print("create neo4j class ...")

def connectDB(self):
self.graph = Graph("http://localhost:7474", username="neo4j", password="123456")

conf = configparser.ConfigParser()
conf.read('demo/neo4jconfig')
url = conf.get("neo4jdb", "url")
username = conf.get("neo4jdb", "username")
password = conf.get("neo4jdb", "password")
self.graph = Graph(url, username=username, password=password)
def matchItembyTitle(self,value):
answer = self.graph.find_one(label="Item",property_key="title",property_value=value)
return answer
Expand Down
4 changes: 4 additions & 0 deletions demo/demo/neo4jconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[neo4jdb]
url = http://192.168.1.16:7474
username = neo4j
password = abc123
2 changes: 1 addition & 1 deletion demo/demo/tagging_data_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def showtagging_data(request):


# 统计当前标注情况
file_object = open('label_data/labels.txt','r')
file_object = open('label_data/labels.txt','r',encoding='utf-8')
s = []
sum = 0
for i in range(17):
Expand Down
6 changes: 3 additions & 3 deletions demo/demo/tagging_data_writefile_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
def tagging_push(request):
ctx = {}
# 先将已有的labels存入字典中
file_object = open('label_data/labels.txt','r')
file_object = open('label_data/labels.txt','r',encoding='utf-8')
s = set()
for f in file_object:
pair = f.split()
s.add(pair[0].strip())
file_object.close()

file_object = open('label_data/word_list.txt','r')
file_object = open('label_data/word_list.txt','r',encoding='utf-8')
all_list = []
for f in file_object:
all_list.append(f.strip())
Expand All @@ -30,7 +30,7 @@ def tagging_push(request):
title = request.GET['title'].strip()
label = request.GET['label'].strip()
if label != None:
file_object = open('label_data/labels.txt','a')
file_object = open('label_data/labels.txt','a',encoding='utf-8')
if title in s:
print("该title已存在,冲突!")
else:
Expand Down
2 changes: 2 additions & 0 deletions demo/label_data/labels.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5612,3 +5612,5 @@ Sugar 0
auxin 0
红十字 3
氟氰戊菊酯 7
狗肾 13
昆明池 2
10 changes: 10 additions & 0 deletions demo/static/js/jquery.metisMenu.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading