Giter VIP home page Giter VIP logo

languagepractical's Introduction

#PAM - LanguagePractical

PAM is a Dutch question parser, which can answer your Dutch questions using DBPedia and local resources found in the Resources map. It is mainly focussed on questions about the Olympics.

##Prerequisites This program is dependent on multiple python libraries:

  • lxml
  • SPARQLWrapper

Make sure you have these installed, this can be done using the following commands:

  • pip install lxml
  • pip install SPARQLWrapper

Also make sure you download the file called pairCounts over here and make sure you place it in the Resources map.

Furthermore, do NOT delete files from the Resources map as they are vital for our program. The program does not work if the files are misplaced or removed.

##Usage

Use the program by opening a terminal window. Go to the map the python files are in and there do the following: python3 main.py

To feed it a file with questions formatted like the questions below you can do the following: python3 main.py < ./Questions/QuestionsFile.txt > ./Questions/OutputFile.txt Running big files of questions takes quite some time.

The program accepts Dutch questions, formatted like the following input:

  • Hoe lang is Usain Bolt?
  • 1 Hoe lang is Usain Bolt? (Note that it is a tab in between the number and sentence)

The program will have the output of a number followed by a tab and then the solution found. The Number is either the number you have given as input (before the tab), or the iteration number the input check is in. An example is shown below: 1 1,96 m

To exit the program type exit or use the key-combination ctrl+D

###Debug

If the program prints all debug statements while this is not wanted, please edit the __DEBUG__ variable in variables.py to False.

languagepractical's People

Contributors

anco88 avatar danielhaitink avatar jwdw avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

languagepractical's Issues

Andersom vragen wordt te vroeg en niet correct gebruikt

Bij de volgende vragen kon hij wel een antwoord vinden maar dat duurde even, nu gaat hij in andersom vragen en geeft een fout antwoord
Wie is de koning van Nederland?
Wie is de president van Amerika?
Waarschijnlijk nog wel meer vragen

Geboorteplaats URI heeft geen type, dus wordt niet herkend

Waar is Usain Bolt geboren ?
Gaat fout omdat de plaats URI geen Location, Town, Country o.i.d. is volgens DBPedia
` geboorteplaats

SELECT ?answer

WHERE{
<http://nl.dbpedia.org/resource/Usain_Bolt> prop-nl:geboorteplaats ?answer
}

['http://nl.dbpedia.org/resource/Trelawny', 'http://nl.dbpedia.org/resource/Sherwood_Content']
location
url: http://nl.dbpedia.org/resource/Trelawny
['http://nl.dbpedia.org/resource/Trelawny']
[]
url: http://nl.dbpedia.org/resource/Sherwood_Content
['http://nl.dbpedia.org/resource/Sherwood_Content']
[] `

Property brons bestaat uit lijst met integers, waar hoogste de juiste is...

Zie titel, brons geeft dit in dbpedia:
prop-nl:brons :
1 (xsd:integer)
2 (xsd:integer)
4 (xsd:integer)

(engelse property is wel te gebruiken)

Waar wij nu 3 getallen zien, en dus 3 als antwoord geven, maar waar 4 het goede antwoord is. Aangezien er waarschijnlijk zulke vragen komen, is wel idee om dit proberen te fixen

Error in parseWhatWhere

Waar is Obama geboren?
<?xml version="1.0" encoding="UTF-8"?>
<alpino_ds version="1.5">
  <node begin="0" cat="top" end="5" id="0" rel="top">
    <node begin="0" cat="whq" end="4" id="1" rel="--">
      <node begin="0" end="1" frame="er_wh_loc_adverb" getal="getal" id="2" index="1" lcat="advp" lemma="waar" naamval="obl" pdtype="adv-pron" persoon="3o" pos="adv" postag="VNW(vb,adv-pron,obl,vol,3o,getal)" pt="vnw" rel="whd" root="waar" sense="waar" special="er_loc" status="vol" vwtype="vb" wh="ywh" word="Waar"/>
      <node begin="0" cat="sv1" end="4" id="3" rel="body">
        <node begin="1" end="2" frame="verb(unacc,sg_heeft,passive)" id="4" infl="sg_heeft" lcat="sv1" lemma="zijn" pos="verb" postag="WW(pv,tgw,ev)" pt="ww" pvagr="ev" pvtijd="tgw" rel="hd" root="ben" sc="passive" sense="ben" stype="whquestion" tense="present" word="is" wvorm="pv"/>
        <node begin="2" end="3" frame="proper_name(sg,'PER')" genus="zijd" getal="ev" graad="basis" id="5" index="2" lcat="np" lemma="Obama" naamval="stan" neclass="PER" ntype="eigen" num="sg" pos="name" postag="N(eigen,ev,basis,zijd,stan)" pt="n" rel="su" rnum="sg" root="Obama" sense="Obama" word="Obama"/>
        <node begin="0" cat="ppart" end="4" id="6" rel="vc">
          <node begin="0" end="1" id="7" index="1" rel="mod"/>
          <node begin="2" end="3" id="8" index="2" rel="obj1"/>
          <node begin="3" buiging="zonder" end="4" frame="verb(hebben,psp,transitive)" id="9" infl="psp" lcat="ppart" lemma="geboren" pos="verb" positie="vrij" postag="WW(vd,vrij,zonder)" pt="ww" rel="hd" root="geboren" sc="transitive" sense="geboren" word="geboren" wvorm="vd"/>
        </node>
      </node>
    </node>
    <node begin="4" end="5" frame="punct(vraag)" id="10" lcat="punct" lemma="?" pos="punct" postag="LET()" pt="let" rel="--" root="?" sense="?" special="vraag" word="?"/>
  </node>
  <sentence sentid="86.92.18.45">Waar is Obama geboren ?</sentence>
</alpino_ds>

Expected type: location
Traceback (most recent call last):
  File "main.py", line 56, in <module>
    solutionList = preParseSentence(line)
  File "/Users/DanielHaitink/Documents/LanguagePractical/prePostParser.py", line 91, in preParseSentence
    solution = parseWhereWhen(alpinoXML, expectedAnswer)
  File "/Users/DanielHaitink/Documents/LanguagePractical/questionParser.py", line 431, in parseWhereWhen
    concepts.append(t.xpath('//node[@rel="obj1" and ../../@rel="su" and ../../../@rel="body"]', smart_strings=False)[0]);
IndexError: list index out of range

URI niet gevonden

Bij de vraag:
Waar is het hoofdkantoor van Apple?
Zoekt hij op een URI voor het hoofdkantoor van Apple i.p.v. Apple

Pakt bijvoeglijk naamwoord van property niet

Hoeveel bronzen medailles heeft Nederland op de Olympische Zomerspelen 2008 ?
Heeft de juiste concept maar medailles als property, niet bronzen medaille
Hoeveel bronzen medailles heeft Nederland op de Olympische Zomerspelen 2008 gewonnen ?
Heeft alleen Nederland als property niet Nederland op de Olympische Zomerspelen 2008

Olympische zomerspelen geeft olympische zomerspelen 2012 als concept

Zie titel.
zomerspelen 2012 heeft meer links erna toe.

In dit geval zou optie kunnen zijn door meerdere concepts (gesorteerd) terug te geven en naar volgende concept te springen als properties niet genoeg overeenkomen. (werkt in dit geval omdat olympische zomerspelen 2012 geen property eerste heeft en olympische zomerspelen wel.
Hoewel vraag is of dit bij meerderheid foute concepts werkt.

Leeftijd toevoegen?

Bij de vragen:
Hoe oud is X en Wat is de leeftijd van X vind hij of lengte of niks omdat dbPedia niet aan leeftijd doet
Misschien huidige datum - geboorte datum doen??

Returns too many answers

With question Wie is de coach van Sven Kramer? it returns: ['http://nl.dbpedia.org/resource/Jac_Orie'] ['Jac Orie']

Also both answers are a list with a string

Teveel toegevoegd aan concept

Bij vraag: Hoeveel deelnemende atleten waren er op de Olympische Spelen van 1896?
pakt hij "er op de Olympische spelen van 1896" als concept

Bij: Hoeveel fakkelsdragers waren er bij de spelen van 2012?
Pakt hij alleen "er"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.