HI,
I need to have a query about religions in each country, I wrote this code in file religion.py
from refo import Plus, Question
from quepy.dsl import HasKeyword
from quepy.parsing import Lemma, Pos, QuestionTemplate, Token, Particle
from dsl import IsCountry, TypesOfReligion
class Country(Particle):
regex = Plus(Pos("DT") | Pos("NN") | Pos("NNS") | Pos("NNP") | Pos("NNPS"))
def interpret(self, match):
name = match.words.tokens.title()
return IsCountry() + HasKeyword(name)
class TypesOfReligionQuestion(QuestionTemplate):
"""
Ex: "list of Religions"
"""
opening = (Pos("WP") + Lemma("religion") + Token("is"))
regex = opening + Question(Pos("DT")) + Country() + Question(Pos("."))
def interpret(self, match):
religion = TypesOfReligion(match.country)
return religion, "enum"
and add this part to dsl.py :
class TypesOfReligion(FixedRelation):
relation = "dbpprop:religion"
reverse = True
but when I checked e.g .
Which religion is in Iran?
--------------------------
Query not generated :(
could anyone help me?
Thanks in advance,