-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If a tv-IRI is annotated with CN then rewrite the tokens to use a relational noun construct. Note that the CSV output is not affected.
- Loading branch information
Showing
10 changed files
with
318 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
% This file is part of the OWL verbalizer. | ||
% Copyright 2008-2011, Kaarel Kaljurand <[email protected]>. | ||
% Copyright 2008-2013, Kaarel Kaljurand <[email protected]>. | ||
% | ||
% The OWL verbalizer is free software: you can redistribute it and/or modify it | ||
% under the terms of the GNU Lesser General Public License as published by the | ||
|
@@ -34,12 +34,17 @@ | |
to perform these beautification transformations. | ||
@author Kaarel Kaljurand | ||
@version 2011-06-11 | ||
@version 2013-09-18 | ||
@bug this module calls the lexicon-module but does not explicitly import it. | ||
*/ | ||
|
||
:- use_module(lexicon, [ | ||
iri_fragment/2, | ||
get_lexicon_entry/3 | ||
]). | ||
|
||
%% ace_niceace(+TokenListIn:list, -TokenListOut:list) is det. | ||
% | ||
% @param TokenListIn is a list of ACE tokens | ||
|
@@ -51,7 +56,7 @@ | |
ace_niceace(In, Out) :- | ||
ace_merge(In, Prefix, Rest), | ||
ace_niceace(Rest, RestOut), | ||
simple_append(Prefix, RestOut, Out). | ||
append(Prefix, RestOut, Out). | ||
|
||
|
||
%% ace_merge(+TokenList:list, -Prefix:list, -NewTokenList:list) is nondet. | ||
|
@@ -71,7 +76,13 @@ | |
|
||
ace_merge([a, cn_sg(Iri) | Rest], [Article], [SurfaceForm | Rest]) :- | ||
!, | ||
lexicon:call(cn_sg(Iri), SurfaceForm), | ||
( | ||
lexicon:call(cn_sg(Iri), SurfaceForm) | ||
-> | ||
true | ||
; | ||
lexicon:iri_fragment(Iri, SurfaceForm) | ||
), | ||
word_article(SurfaceForm, Article). | ||
|
||
ace_merge([qs(Token) | Rest], [], [TokenQuotes | Rest]) :- | ||
|
@@ -87,26 +98,60 @@ | |
!, | ||
my_concat_atom([Token, ','], TokenComma). | ||
|
||
ace_merge([does, not, tv_pl(Iri) | Rest], [is, not, Article, SurfaceForm, of], Rest) :- | ||
verb_as_noun(Iri, Article, SurfaceForm), | ||
!. | ||
|
||
ace_merge([do, not, tv_pl(Iri) | Rest], [are, not, Article, SurfaceForm, of], Rest) :- | ||
verb_as_noun(Iri, Article, SurfaceForm), | ||
!. | ||
|
||
ace_merge([tv_sg(Iri) | Rest], [is, Article, SurfaceForm, of], Rest) :- | ||
verb_as_noun(Iri, Article, SurfaceForm), | ||
!. | ||
|
||
ace_merge([tv_pl(Iri) | Rest], [are, Article, SurfaceForm, of], Rest) :- | ||
verb_as_noun(Iri, Article, SurfaceForm), | ||
!. | ||
|
||
ace_merge([that, _, not, tv_vbg(Iri), by | Rest], [whose, SurfaceForm, is, not], Rest) :- | ||
verb_as_noun(Iri, _Article, SurfaceForm), | ||
!. | ||
|
||
ace_merge([_, not, tv_vbg(Iri), by | Rest], ['\'s', SurfaceForm, is, not], Rest) :- | ||
verb_as_noun(Iri, _Article, SurfaceForm), | ||
!. | ||
|
||
ace_merge([that, _, tv_vbg(Iri), by | Rest], [whose, SurfaceForm, is], Rest) :- | ||
verb_as_noun(Iri, _Article, SurfaceForm), | ||
!. | ||
|
||
ace_merge([_, tv_vbg(Iri), by | Rest], ['\'s', SurfaceForm, is], Rest) :- | ||
verb_as_noun(Iri, _Article, SurfaceForm), | ||
!. | ||
|
||
ace_merge([Token | Rest], [Token], Rest) :- | ||
atomic(Token), | ||
!. | ||
|
||
ace_merge([Token | Rest], [SurfaceForm], Rest) :- | ||
functor(Token, _, 1), | ||
lexicon:call(Token, SurfaceForm). | ||
lexicon:call(Token, SurfaceForm), | ||
!. | ||
|
||
ace_merge([Token | Rest], [SurfaceForm], Rest) :- | ||
functor(Token, _, 1), | ||
arg(1, Token, Iri), | ||
lexicon:iri_fragment(Iri, SurfaceForm). | ||
|
||
%% simple_append(?List1:list, ?List2:list, ?List3:list) is nondet. | ||
% | ||
% @param List1 is an empty list or a list of one element | ||
% @param List2 is a list | ||
% @param List3 is a list | ||
|
||
%% | ||
% | ||
% This is a special case of append/2 | ||
% | ||
simple_append([], List, List). | ||
simple_append([X], List, [X | List]). | ||
|
||
verb_as_noun(Iri, Article, SurfaceForm) :- | ||
get_lexicon_entry('CN_sg', Iri, SurfaceForm), | ||
!, | ||
word_article(SurfaceForm, Article). | ||
|
||
%% word_article(+Word:atom, -Article:atom) is det. | ||
% | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Rex is not an eater of Mick. | ||
|
||
No goat is an eater of something that is not a leaf. | ||
|
||
Everything whose eater is a goat is a leaf. | ||
Everything that is an eater of nothing but leaves is a goat. | ||
|
||
Everything is an eater of at most 1 thing. | ||
|
||
Everything 's eater is at most 1 thing. | ||
|
||
If X is an eater of something that is an eater of Y then X is an eater of Y. | ||
|
||
Everything that is an eater of something is an animal. | ||
|
||
Everything whose eater is something is a food that is not an automobile. | ||
|
||
If X is a hater of Y then Y is an eater of X. | ||
If X is an eater of Y then Y is a hater of X. | ||
|
||
If X is a hater of Y then it is false that X is an eater of Y. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
ignored Prefix(story,http://www.example.org/story.owl#) | ||
|
||
ignored Prefix(ace_lexicon,http://attempto.ifi.uzh.ch/ace_lexicon#) | ||
|
||
ignored AnnotationAssertion(AnnotationProperty(http://attempto.ifi.uzh.ch/ace_lexicon#CN_sg),IRI(http://www.example.org/story.owl#eat),^^(eater,)) | ||
|
||
ignored AnnotationAssertion(AnnotationProperty(http://attempto.ifi.uzh.ch/ace_lexicon#CN_sg),IRI(http://www.example.org/story.owl#hate),^^(hater,)) | ||
|
||
ignored AnnotationAssertion(AnnotationProperty(http://attempto.ifi.uzh.ch/ace_lexicon#CN_pl),IRI(http://www.example.org/story.owl#leaf),^^(leaves,)) | ||
|
||
pn_sg http://owl.man.ac.uk/2005/07/sssw/people#Rex | ||
f does | ||
f not | ||
tv_pl http://www.example.org/story.owl#eat | ||
pn_sg http://owl.man.ac.uk/2005/07/sssw/people#Mick | ||
f . | ||
|
||
f No | ||
cn_sg http://www.example.org/story.owl#goat | ||
tv_sg http://www.example.org/story.owl#eat | ||
f a | ||
f thing | ||
f that | ||
f is | ||
f not | ||
f a | ||
cn_sg http://www.example.org/story.owl#leaf | ||
f . | ||
|
||
f Every | ||
f thing | ||
f that | ||
f is | ||
tv_vbg http://www.example.org/story.owl#eat | ||
f by | ||
f a | ||
cn_sg http://www.example.org/story.owl#goat | ||
f is | ||
f a | ||
cn_sg http://www.example.org/story.owl#leaf | ||
f . | ||
f Every | ||
f thing | ||
f that | ||
tv_sg http://www.example.org/story.owl#eat | ||
f nothing | ||
f but | ||
cn_pl http://www.example.org/story.owl#leaf | ||
f is | ||
f a | ||
cn_sg http://www.example.org/story.owl#goat | ||
f . | ||
|
||
f Every | ||
f thing | ||
tv_sg http://www.example.org/story.owl#eat | ||
f at | ||
f most | ||
f 1 | ||
f thing | ||
f . | ||
|
||
f Every | ||
f thing | ||
f is | ||
tv_vbg http://www.example.org/story.owl#eat | ||
f by | ||
f at | ||
f most | ||
f 1 | ||
f thing | ||
f . | ||
|
||
f If | ||
f X | ||
tv_sg http://www.example.org/story.owl#eat | ||
f a | ||
f thing | ||
f that | ||
tv_sg http://www.example.org/story.owl#eat | ||
f Y | ||
f then | ||
f X | ||
tv_sg http://www.example.org/story.owl#eat | ||
f Y | ||
f . | ||
|
||
f Every | ||
f thing | ||
f that | ||
tv_sg http://www.example.org/story.owl#eat | ||
f a | ||
f thing | ||
f is | ||
f a | ||
cn_sg http://www.example.org/story.owl#animal | ||
f . | ||
|
||
f Every | ||
f thing | ||
f that | ||
f is | ||
tv_vbg http://www.example.org/story.owl#eat | ||
f by | ||
f a | ||
f thing | ||
f is | ||
f a | ||
cn_sg http://www.example.org/story.owl#food | ||
f that | ||
f is | ||
f not | ||
f a | ||
cn_sg http://www.example.org/story.owl#automobile | ||
f . | ||
|
||
f If | ||
f X | ||
tv_sg http://www.example.org/story.owl#hate | ||
f Y | ||
f then | ||
f Y | ||
tv_sg http://www.example.org/story.owl#eat | ||
f X | ||
f . | ||
f If | ||
f X | ||
tv_sg http://www.example.org/story.owl#eat | ||
f Y | ||
f then | ||
f Y | ||
tv_sg http://www.example.org/story.owl#hate | ||
f X | ||
f . | ||
|
||
f If | ||
f X | ||
tv_sg http://www.example.org/story.owl#hate | ||
f Y | ||
f then | ||
f it | ||
f is | ||
f false | ||
f that | ||
f X | ||
tv_sg http://www.example.org/story.owl#eat | ||
f Y | ||
f . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0"?> | ||
<Ontology xmlns="http://www.w3.org/2002/07/owl#" | ||
xml:base="http://org.semanticweb.ontologies/Ontology1256143016364769000" | ||
xmlns:xml="http://www.w3.org/XML/1998/namespace"> | ||
|
||
<Prefix name="story" IRI="http://www.example.org/story.owl#"/> | ||
<Prefix name="ace_lexicon" IRI="http://attempto.ifi.uzh.ch/ace_lexicon#"/> | ||
|
||
<AnnotationAssertion> | ||
<AnnotationProperty abbreviatedIRI="ace_lexicon:CN_sg"/> | ||
<IRI>http://www.example.org/story.owl#eat</IRI> | ||
<Literal>eater</Literal> | ||
</AnnotationAssertion> | ||
|
||
<AnnotationAssertion> | ||
<AnnotationProperty abbreviatedIRI="ace_lexicon:CN_sg"/> | ||
<IRI>http://www.example.org/story.owl#hate</IRI> | ||
<Literal>hater</Literal> | ||
</AnnotationAssertion> | ||
|
||
<AnnotationAssertion> | ||
<AnnotationProperty abbreviatedIRI="ace_lexicon:CN_pl"/> | ||
<IRI>http://www.example.org/story.owl#leaf</IRI> | ||
<Literal>leaves</Literal> | ||
</AnnotationAssertion> | ||
|
||
<NegativeObjectPropertyAssertion> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
<NamedIndividual IRI="http://owl.man.ac.uk/2005/07/sssw/people#Rex"/> | ||
<NamedIndividual IRI="http://owl.man.ac.uk/2005/07/sssw/people#Mick"/> | ||
</NegativeObjectPropertyAssertion> | ||
<DisjointClasses> | ||
<Class abbreviatedIRI="story:goat"/> | ||
<ObjectSomeValuesFrom> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
<ObjectComplementOf> | ||
<Class abbreviatedIRI="story:leaf"/> | ||
</ObjectComplementOf> | ||
</ObjectSomeValuesFrom> | ||
</DisjointClasses> | ||
<EquivalentClasses> | ||
<Class abbreviatedIRI="story:goat"/> | ||
<ObjectAllValuesFrom> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
<Class abbreviatedIRI="story:leaf"/> | ||
</ObjectAllValuesFrom> | ||
</EquivalentClasses> | ||
<FunctionalObjectProperty> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
</FunctionalObjectProperty> | ||
<InverseFunctionalObjectProperty> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
</InverseFunctionalObjectProperty> | ||
<TransitiveObjectProperty> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
</TransitiveObjectProperty> | ||
<ObjectPropertyDomain> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
<Class abbreviatedIRI="story:animal"/> | ||
</ObjectPropertyDomain> | ||
<ObjectPropertyRange> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
<ObjectIntersectionOf> | ||
<Class abbreviatedIRI="story:food"/> | ||
<ObjectComplementOf> | ||
<Class abbreviatedIRI="story:automobile"/> | ||
</ObjectComplementOf> | ||
</ObjectIntersectionOf> | ||
</ObjectPropertyRange> | ||
<InverseObjectProperties> | ||
<ObjectProperty abbreviatedIRI="story:hate"/> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
</InverseObjectProperties> | ||
<DisjointObjectProperties> | ||
<ObjectProperty abbreviatedIRI="story:hate"/> | ||
<ObjectProperty abbreviatedIRI="story:eat"/> | ||
</DisjointObjectProperties> | ||
</Ontology> |
Oops, something went wrong.