예제 #1
0
from wtforms.validators import Required

from whoosh.index import create_in
from whoosh.qparser import QueryParser
from whoosh.fields import Schema, TEXT, STORED
import whoosh.index as index

import sys
sys.path.append("..")
import insummer

from insummer.summarization.ilp import dis_ilp as DI
from insummer.common_type import Question, Answer, build_question
from insummer.util import NLP

nlp = NLP()

app = Flask(__name__)

Bootstrap(app)
# in a real app, these should be configured through Flask-Appconfig
app.config['SECRET_KEY'] = 'devkey'
app.config['RECAPTCHA_PUBLIC_KEY'] = \
'6Lfol9cSAAAAADAkodaYl9wvQCwBMr3qGR_PPHcw'


class search_form(Form):
    name = StringField('', validators=[DataRequired()])


index_dir = "/home/lavi/project/insummer/index"
예제 #2
0
#!/usr/bin/python3

import sys
sys.path.append("..")
import insummer
from insummer.query_expansion.entity_finder import example_entity_finder, NgramEntityFinder
from insummer.read_conf import config
from insummer.common_type import Question
from insummer.util import NLP

nlp = NLP()

title = "How do Motorcycles pollute?"

answer = " Motorcycles and scooters are an appealing alternative to shelling out big bucks filling up the family truckster, which is one reason sales are going through the roof. But riding on two wheels may not be any more environmentally responsible than riding on four. \
Turns out the average motorcycle is 10 times more polluting per mile than a passenger car, light truck or SUV. It seems counter-intuitive, because motorcycles are about twice as fuel-efficient as cars and emit a lot less C02. \
So what gives? \
Susan Carpenter lays it all out in a Los Angeles Times column. She found that, although motorcycles and scooters comprise 3.6 percent of registered vehicles in California and 1 percent of vehicle miles traveled, they account for 10 percent of passenger vehicles' smog-forming emissions. \
Motorcycle engines are twice as efficient as automobile engines, she notes, so they generally emit less carbon dioxide. But they emit large amounts of nitrogen oxides, which along with hydrocarbons and carbon monoxide are measured by state and federal air quality regulators to determine whether vehicles meet emissions rules. \
Catalytic converters and other emissions control devices would clean things up, but they're often too big, too heavy or too hot to install on motorcycles. For that reason and others that Carpenter outlines in the column, the Environmental Protection Agency and California Air Resources Board are more lenient when it comes to motorcycle emissions. \
\"The emissions picture [for motorcycles] is pretty grim,\" she quotes John Swanton of the Air Resources Board saying, but we think it's fair for where motorcycles are today. "


def test1():
    naive_question = Question("sh", "", "", "")

    my = example_entity_finder(naive_question)

    #my.find()
    #my.print()
예제 #3
0
파일: test.py 프로젝트: JunoShen/insummer
 def test_norm_text(self):
     nlp = NLP()
     self.assertEqual(nlp.norm_text('dogs'),'dog','测试归一化句子')
예제 #4
0
 def test_norm_text(self):
     nlp = NLP()
     self.assertEqual(nlp.norm_text('dogs'), 'dog', '测试归一化句子')