【问题标题】:tuprolog program - term part not ended with period exceptiontuprolog 程序 - 术语部分未以期间异常结束
【发布时间】:2010-09-23 13:39:25
【问题描述】:

我遇到了这个异常

Exception in thread "main" alice.tuprolog.InvalidTheoryException: The term part is not ended with a period.
    at alice.tuprolog.TheoryManager.consult(Unknown Source)
    at alice.tuprolog.Prolog.addTheory(Unknown Source)
    at alice.tuprolog.Prolog.setTheory(Unknown Source)
    at javaapplication9.Main.main(Main.java:32)

Java 结果:1

我可以从这个异常中了解到,输入 prolog 文件中的一些问题,这是我的输入文件,请告诉 mw 如何解决这个问题

noun('doctor_investigation_system_(DIS)').
noun('hospital_information_system_(HIS)').
noun('patients,_doctors,_nurses,_diseases,').
verb('have').
noun('unique_hospital_number').
noun('first_name,').
noun('last_name,').
noun('group,_e.g.,_government_officers,_social_security_group,_etc.)').
noun('privilege_types_(rights').
noun('particular_person').
verb('register').
noun('first_visit').
noun('multiple_privilege_types,').
verb('choose').
noun('first_priority').
noun('privilege_type').
verb('define').
noun('secondary_hospital,').
noun('registration_place,').
noun('expired_date').
noun('patient’s_information').
noun('first_name').
noun('last_name').
verb('see').
noun('patient’s_height,_weight,_blood_pressure,').
verb('finish').
verb('investigate').
verb('write').
noun('patient’s_diseases').
noun('unique_code').
noun('generic_name,').
noun('scientific_name').
noun('multiple_generic_names').
verb('allow').
noun('disease’s_information').
verb('consult').
noun('other_doctors').
verb('maintain').
verb('keep').
noun('different_medicines').
noun('different_prices').
verb('make').
noun('specific_time').
noun('identification_number').
cop('part of', 'be').
dep('doctor within_investigation_system_(DIS)', 'part of').
prep('part of', 'hospital_information_system_(HIS)').
nsubj('manipulates', 'DIS').
dobj('manipulates', 'datum about').
prep('datum about', 'patient ats,_doctor withins,_nurses,_diseases,').
prep('datum about', 'medicine').
conj_and('patient ats,_doctor withins,_nurses,_diseases,', 'medicine').
nsubj('have', 'patient at').
dobj('have', 'unique_hospital_number').
part ofmod('unique_hospital_number', '(hn),').
dobj('(hn),', 'first_name of,').
nsubj('reserved by', 'last_name of,').
nsubj('group,_e.g.,_government_officers,_social_security_group,_etc.)', 'last_name of,').
conj_and('last_name of,', 'privilege_types_(rights').
nsubj('reserved by', 'privilege_types_(rights').
dep('have', 'reserved by').
prep('reserved by', 'part oficular_person').
dep('have', 'group,_e.g.,_government_officers,_social_security_group,_etc.)').
conj_or('reserved by', 'group,_e.g.,_government_officers,_social_security_group,_etc.)').
nsubj('register on', 'patient at').
prep('register on', 'date of').
prep('date of', 'first_visit').
prep('date of', 'patient at').
conj_and('first_visit', 'patient at').
nsubj('record by', 'profile').
cop('record by', 'be').
dep('register on', 'record by').
prep('record by', 'officer').
nsubj('have', 'patient at').
dobj('have', 'multiple_privilege_types,').
prep('one of', 'multiple_privilege_types,').
nsubj('choose as', 'one of').
rcmod('multiple_privilege_types,', 'choose as').
prep('choose as', 'first_priority').
nsubj('define', 'privilege_type').
amod('hospital,', 'primary').
dobj('define', 'hospital,').
prep('define', 'secondary_hospital,').
dep('secondary_hospital,', 'registration_place,').
dep('secondary_hospital,', 'expired_date of').
conj_and('registration_place,', 'expired_date of').
nsubj('search', 'nurse').
dobj('search', 'patient at’s_information').
prepc_by('search', 'use').
nsubj('first_name of', 'HN,').
xcomp('use', 'first_name of').
xcomp('use', 'last_name of').
conj_or('first_name of', 'last_name of').
nsubj('see', 'patient at').
dobj('see', 'doctor within,').
dobj('need', 'doctor within,').
nsubj('need', 'nurse').
xsubj('record by', 'nurse').
rcmod('doctor within,', 'need').
xcomp('need', 'record by').
dobj('record by', 'patient at’s_height,_weight,_blood_pressure,').
dobj('record by', 'symptom').
conj_and('patient at’s_height,_weight,_blood_pressure,', 'symptom').
nsubj('finish', 'doctor within').
xcomp('finish', 'investigate').
dobj('investigate', 'patient at,').
dobj('have', 'patient at,').
nsubj('have', 'doctor within').
xsubj('write', 'doctor within').
rcmod('patient at,', 'have').
xcomp('have', 'write').
dobj('write', 'patient at’s_diseases').
nsubj('have', 'disease').
amod('“icd', 'unique_code').
dep('unique_code', '(called').
dobj('have', '“icd').
amod('“icd', 'generic_name of,').
amod('“icd', 'scientific_name of').
conj_and('generic_name of,', 'scientific_name of').
num('disease', 'One').
nsubj('have', 'disease').
dobj('have', 'multiple_generic_name ofs').
num('scientific_name of', 'one of').
dobj('have', 'scientific_name of').
conj_only('multiple_generic_name ofs', 'scientific_name of').
nsubj('allow', 'system').
dobj('allow', 'officer').
infmod('officer', 'print by').
dobj('print by', 'disease’s_information').
prep('print by', 'use').
dep('use', 'code').
nsubj('consult with', 'doctor within').
prep('consult with', 'other_doctor withins about').
prep('other_doctor withins about', 'patient at').
nsubj('case,', 'that').
cop('case,', 'be').
dobj('have', 'case,').
nsubj('have', 'name of').
prep('name of', 'doctor within').
prep('name of', 'name of').
conj_and('doctor within', 'name of').
prep('name of', 'consult withant').
rcmod('case,', 'have').
xcomp('have', 'maintain').
nsubj('be', 'name of').
prep('name of', 'doctor within').
ccomp('otherwise,', 'be').
ccomp('be', 'keep').
nsubj('order', 'doctor within').
nsubj('have', 'medicine').
conj_and('medicine', 'different_medicines').
nsubj('have', 'different_medicines').
ccomp('order', 'have').
dobj('have', 'different_prices').
nsubj('make with', 'doctor within').
dobj('make with', 'appointment').
prep('make with', 'patient at').
cop('more', 'be').
dep('there', 'more').
num('doctor within', 'one of').
nsubj('make with', 'doctor within').
prep('doctor within', 'clinic').
prep('doctor within', 'doctor within').
conj_and('clinic', 'doctor within').
dobj('make with', 'appointment').
num('patient at', 'one of').
prep('make with', 'patient at').
prep('patient at', 'specific_time').
nsubj('have', 'list of').
xsubj('maintain', 'list of').
prep('list of', 'clinic').
xcomp('have', 'maintain').
xcomp('have', 'clinic').
conj_and('maintain', 'clinic').
cop('subdivision of', 'be').
xcomp('have', 'subdivision of').
conj_and('maintain', 'subdivision of').
prep('subdivision of', 'depart ofment').
conj_and('doctor within', 'nurse').
cop('staff', 'be').
dep('doctor within', 'staff').
nsubj('have', 'nurse').
conj_and('nurse', 'doctor within').
nsubj('have', 'doctor within').
dobj('have', 'identification_number').
part ofmod('identification_number', '(id),').
nsubj('last_name of,', 'first_name of,').
xcomp('(id),', 'last_name of,').
xcomp('(id),', 'address').
conj_and('last_name of,', 'address').
nsubj('need', 'we').
xsubj('keep', 'we').
xcomp('need', 'keep').
dobj('keep', 'clinic').
nsubj('work', 'doctor within').
cop('work', 'be').
rcmod('clinic', 'work').

编辑

异常行和位置

Exception line : -1 Position: -1

【问题讨论】:

  • 根据文档,InvalidTheoryException 有一个 line 和一个 pos 字段。捕获异常并将这些值打印到控制台。 (并在此处发布结果)
  • 异常行:-1 位置:-1
  • 您的某些地方似乎有编辑错误:"of" 似乎已在某些地方的"part" 之后插入。例如在 prep('subdivision of', 'depart ofment'). 中。这可能是奇怪函子part ofmod 的原因。
  • 风格要点:如果将具有相同函子的子句放在一起,通常会更好、更清晰。因此,例如将所有 xcomp/2 子句放在一起。一些 Prologs 要求这样做。
  • 代码是自动生成的,所以有这样的问题。当我在序言中查询时,我不止一次得到相同的解决方案..有没有办法获得一组独特的解决方案?

标签: java exception prolog tuprolog


【解决方案1】:

错误来自以下行:

mod('unique_hospital_number', '(hn),') 的一部分。

预计在“部分”之后有一段时间。我对 tuprolog 或语法知之甚少,无法确切知道问题所在。 “术语部分不以句号结尾。”这意味着术语“部分”不以句点结尾。

至少你现在知道去哪里找了。

【讨论】:

    猜你喜欢
    • 2014-08-12
    • 2015-01-29
    • 2014-02-18
    • 1970-01-01
    • 1970-01-01
    • 2017-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多