예제 #1
0
import nn
import preprocessing
from dictionary import *
from predicate_nn import bag_of_words

DICT_FILE = '{}predicate/dats/dict_predicate.dat'.format(path)
WEIGHTS_FILE = '{}predicate/dats/weights_predicate.dat'.format(path)

d = DictionaryC()
d.load(DICT_FILE)

network = nn.Net()
network.load(WEIGHTS_FILE)

predicate = lambda text, res : 'http://dbpedia.org/ontology/{}'.format(vec_to_class(network.net(bag_of_words(preprocessing.full(text), d.dictionary)), d.classes))

import sys
sys.path.insert(0, path)
import app_template
import return_template

configfile = "{}predicate/predicate.conf".format(path)
aboutendpoint = "/about"
healthendpoint = "/health"

data_type = 'predicate'
asks = []

blueprint = return_template.service(predicate, asks, data_type, configfile).relation_clf
app_template.app(configfile, aboutendpoint, healthendpoint, blueprint)
예제 #2
0
파일: app_object.py 프로젝트: Creearc/Papka
print('APP_Object')
path = '/home/students/stalknia/Papka/apps/'
import sparql

objectt = lambda text, res : sparql.get(res[0], res[1])

import sys
sys.path.insert(0, path)
import app_template
import return_template

configfile = "{}object/object.conf".format(path)
aboutendpoint = "/about"
healthendpoint = "/health"

data_type = 'result'

asks = ['subject', 'predicate']

blueprint = return_template.service(objectt, asks, data_type, configfile).relation_clf
app_template.app(configfile, aboutendpoint, healthendpoint, blueprint)