How to Solve This Problem ..?
Using
conceptual dependencies
predicate calculus/logic
conceptual graph
to represent the following sentences
a) All dogs bark.
b) No school buses are purple.
c) Some drivers do not obey the speed limit
d) Mary borrows a book with red cover from the library.
f) Every book is either an encyclopedia or a dictionary but not both.
This seems like a homework assignment. If it is, I'd love to know more about the class. It seems to be one I would like to know the professor etc.
Because it amuses me, I'll try one of these.
All dogs bark.
this seems to be an English form of the predicate calculus.
forall ((x Dog)) (bark x).
assuming that Dog is defined as a proper category and bark is an appropriate predicate.
I can't help with the Conceptual Dependency representation unless you share what set of primitives you have to work with. Do you use PTRANS and MTRANS ? Is the air moving from a bark considered to be a physical object moved ? We need more definition to understand what you are trying to do.
Why did you not include DRS ? It seems to be a very common representation in many NLP applications currently.
Which syntax for Conceptual graphs are you using? the original John Sowa set from 1984? What grammar do you need to use ? CGIF ? Common Logic ?
Best Wishes,
David
Related
I've been working on a Question Answering engine in C#. I have implemented the features of most modern systems and are achieving good results. Despite the aid of Wordnet , one problem I haven't been able to solve yet is changing the user input to the correct term.
For example
changing Weight -> Mass
changing Tall -> Height
My question is about the existence of some sort of resource that can aid me in this task of changing the terms to the correct terms.
Thank You
Looking at all the synsets in WordNet for both Mass and Weight I can see that there is no shared synset and thus there is no meaning in common. Words that actually do have the same meaning can be matched by means of their synset labels, as I'm sure you've realized.
In my own natural language engine (http://nlp.abodit.com) I allow users to use any synset label in the grammar they define but I would still create two separate grammar rules in this case, one recognizing questions about mass and one recognizing questions about weight.
However, there are also files for Wordnet that give you class relationships between synsets too. For example, if you type 'define mass' into my demo page you'll see:-
4. wn30:synset-mass-noun-1
the property of a body that causes it to have weight in a gravitational field
--type--> wn30:synset-fundamental_quantity-noun-1
--type--> wn30:synset-physical_property-noun-1
ITokenText, IToken, INoun, Singular
And if you do the same for 'weight' you'll also see that it too has a class relationship to 'physical property'.
In my system you can write a rule that recognizes a question about a 'physical property' and perhaps a named object and then try to figure out which physical property they are likely to be asking about. And, perhaps, if you can't match maybe just tell them all about the physical properties of the object.
The method signature in my system would be something like ...
... QuestionAboutPhysicalProperties (... IPhysicalProperty prop,
INamedObject obj, ...)
... and in code I would look at the properties of obj and try to find one called 'prop'.
The only way that I know how to do this effectively requires having a large corpus of user query sessions and a happiness measure on sessions, and then finding correlations between substituting word x for word y (possibly given some context z) that improves user happiness.
Here is a reasonable paper on generating query substitutions.
And here is a new paper on generating synonyms from anchor text, which doesn't require a query log.
Suppose I have math algorithm e.g.
A = B + C
C = D + E
F = B + D
I would like to draw a diagram to represent it and the flow of the algorithm i.e. people know how the value of A calculate. Is there tool or the name of UML diagram that I can take a look?
Maybe a Dataflow Diagram?
Something like this:
It's not part of UML, but can be a very useful way to show computation.
hth.
There is an proposal to supplement UML diagrams by the diagrams called KOPENOGRAM. Which rather on data flow focus on algorithmical structure, conditions, loops, etc. As this is an proposal, limited specific tools exist to generate or draw kopenograms from source code (AFAIK there are Java plugins for BlueJ or NetBeans). However, Excel or any spreadsheet app might be used to make table and borders.
Your example will look like:
No dependency is shown on operations as in previous example, as this is task rather for compiler.
UML diagrams are either about static structure (classes/components/packages) or interaction between entities (activity/sequence diagrams/state machines).
Algorithms or algorithm design are not covered by UML (very much like any other type of concrete method specification).
Introduction
I am programming a semantic web application in haskell.
With hsparql http://hackage.haskell.org/package/hsparql I can access my Tripple Store. Currently I use http://4store.org/ (mainly because it was easy to install). I use snap http://snapframework.com/ to do the servlet programming (Yesod is very cool too!!).
Currently I use SKOS to represent bookmarks categories in RDF.
Links on SKOS:
http://www.w3.org/TR/skos-reference/
http://www.athenaeurope.org/athenawiki/index.php/SKOS
Basically, a Skos Concept is a category. It has a URL (as kind of ID)
and a Label. Further Skos Concepts can have sub concepts, defined with "broader"
and "narrower".
For example in my bookmarks there is the SKOS concept "all bookmarks", with a sub concept
"haskell bookmarks". And both concepts have a URL (e.g. as ID) and a Label.
Also "haskell bookmarks" has a relation that the broader concept is "all bookmarks".
My Problem
I need a data structure in haskell for SKOS.
My current one is:
-- Type Aliases.
type Url = String
type Label = String
-- Date Structure.
data SkosConcept = SkosConcept {
url :: Url
, label :: Label
, subConcepts :: [SkosConcept]
} deriving (Show)
I think it's not a good way, but I don't know a better one.
Further, in the future the data structure needs to be extended to multiple labels,
and means to store related concepts, ...
Also some concepts may not have any sub concepts.
Any pointers on how to improve the data structure or 'do it right'?
===== EDIT: ======
The problem is that a skos concept may have multiple broader skos concepts.
So my "haskell bookmarks" can have two broader skos concepts (e.g. categories) named "programming bookmarks" and "my important bookmarks".
The only solutions I can think of at the moment is using:
a directed graph for the "broader" relation of skos concepts
a binary relation "broader" (but I don't know if there is good haskell support)
no intermediate data structures and all my functions query the RDF Tripple Store
Rather than trying to store a bidirectional structure directly, why not use the standard Graph approach, and store a tuple containing both the set of concepts, and containing the set of relations between concepts?
cf: http://hackage.haskell.org/package/fgl
I was wondering if anyone was familiar with any attempts at algorithmic sentence negation.
For example, given a sentence like "This book is good" provide any number of alternative sentences meaning the opposite like "This book is not good" or even "This book is bad".
Obviously, accomplishing this with a high degree of accuracy would probably be beyond the scope of current NLP, but I'm sure there has been some work on the subject. If anybody knows of any work, care to point me to some papers?
While I'm not aware of any work that specifically looks at automatically generating negated sentences, I imagine a good place to start would be to read up on linguistics work in formal semantics and pragmatics. A good accessible introduction would be Steven C. Levinson's Pragmatics book.
One issue that I think you'll run into is that it can be very difficult to negate all the information that is conveyed by a sentence. For example, take:
John fixed the vase that he broke.
Even if you change this to John did not fix the vase that he broke, there is a presupposition that there is a vase and that John broke it.
Similarly, simply negating the sentence John did not stopped using drugs as John stopped using drugs still conveys that John, at one point, used drugs. A more thorough negation would be John never used drugs.
Some existing natural language processing (NLP) work that you might want to look at is MacCartney and Manning 2007's Natural Logic for Textual Inference. In this paper they use George Lakoff's notion of Natural Logic and Sanchez Valencia's monotonicity calculus to create software that automatically determines whether one sentence entails another. You could probably use some their techniques for detecting non-entailment to artificially construct negated and contradicting sentences.
I'd recommend checking out wordnet. You can use it to lookup antonyms for a word, so you could conceivably replace "bad" with "not good" since bad is an antonym of good. NLTK has a simple python interface to wordnet.
The naïve way of course, is to try to add "not" right after {am,are,is}. I have no idea how this will work in your setting though, it will probably only work with predicate-like sentences.
For simple sentences parse looking for adverbs or adjectives given the English grammar rules and substitute an antonym if only one meaning exists. Otherwise use the correct English negation rule to negate the verb (ie: is -> is not).
High level algorithm:
Look up each word for it's type (noun, verb, adjective, adverb, conjunction, etc...)
Infer sentence structure from word type sequences (Your sentence was: article, noun, verb, adjective/adverb; This is known to be a simple sentence.)
For simple sentences, choose one invertible word and invert it. Either by using an antonym, or negating the verb.
For more complex sentences, such as those with subordinate clauses, you will need to have more complex analysis, but for simple sentences, this shouldn't be infeasible.
There's a similar process for first-order logic. The usual algorithm is to map P to not P, and then perform valid translations to move the not somewhere convenient, e.g.:
Original: (not R(x) => exists(y) (O(y) and P(x, y)))
Negate it: not (not R(x) => exists(y) (O(y) and P(x, y)))
Rearrange: not (R(x) or exists(y) (O(y) and P(x, y)))
not R(x) and not exists(y) (O(y) and P(x, y))
not R(x) and forall(y) not (O(y) and P(x, y))
not R(x) and forall(y) (not O(y) or not P(x, y))
Performing the same on English you'd be negating "If it's not raining here, then there is some activity that is an outdoors activity and can be performed here" to "It is NOT the case that ..." and finally into "It's not raining and every possible activity is either not for outdoors or can't be performed here."
Natural language is a lot more complicated than first-order logic, of course... but if you can parse the sentence into something where the words "not", "and", "or", "exists" etc. can be identified, then you should be able to perform similar translations.
For a rule-based negation approach, you can take a look at the Python module negate1.
1 Disclaimer: I am the author of the module.
As for some papers related to the topic, you can take a look at:
Understanding by Understanding Not: Modeling Negation in Language Models
An Analysis of Natural Language Inference Benchmarks through the Lens of Negation
Not another Negation Benchmark: The NaN-NLI Test Suite for Sub-clausal Negation
Nice demos using NTLK - http://text-processing.com/demo and a short writeup - http://text-processing.com/demo/sentiment/.
can two use cases extend or include each other at the same time?
A extend/include B and B extend/include A
I'm pretty sure the answer is "NO".
You've just described the digital equivalent fo the chicken and egg problem.
Circular references are [almost] always Bad Things (tm). The only place I know it to not be horrible is in the context of a linked list, in which each entry has a pointer to another of its own type.
If (A includes/extends B and B includes/extends A) then A = B
Admitting that if A extends/includes B then A >= B
It seems likely not, though I'm sure you could do it if you went generic [and useless] enough. Do you have a specific example? There are always exemptions to the rules and I'd be curious to see one.
below is the senario for business use case (business modelling) not system use case:
USE Case A: Service Vehicle
Use Case B: Authorise Additional repair
Use Case C: Repair Vehicle
Additional repair could be identified during initial repair.
or repair could be identified as a new repair during service,
in both case, customer authorisation is required?
A extend B and B extend C (authorisation and start of repair identified during service)
C extend B (authorisation for additional repair identified during repair)
It's rare but in the general case, there's nothing that prevents use cases from including/using each other.
the answer is no. extend and include are mutually-exclusive relationship types. Most likely the use-cases are incorrectly factored/separated, or you've misunderstood the extend/include relationship definitions, or both.
given the example you posted (fyi it is better for you to edit the question rather than post an answer that does not answer the original question) i would venture that B extends A and B extends C, since in both cases A and C additional repairs (case B) may be identified.
alternately, use cases A and C could conditionally include use case B
offhand, i would model this as Work On Vehicle, which is a composition of 2 use-cases, Obtain Customer Authorization, and Service Vehicle, where the latter includes any kind of service or repair and requires the output of the former before starting the work. The notion of 'additional repairs' is just another instance of Work On Vehicle.
but i don't know the full business context, so your mileage may vary ;-)
EDIT: you wrote "but in this case: work is being carried out and further authorisation is required during the course of work", but i don't see how that really matters.
the first step is to eliminate the confusion about includes and extends. Try modeling each use-case completely and independently, and then look at what is common to see if includes/extends is warranted
"YES" - Checked the Spec.
I just read through the UML specification section for use cases:
http://www.omg.org/spec/UML/2.1.2/Superstructure/PDF/
There was no rule that would prevent doing this that I could find. Many people may conceptually have a problem with this, but that is ok, as you are just instinctively trying to objectize or structure use cases logically. Use Cases are a behavior (or set) and are not like classes/"objects". We are not talking about Java objects.
Even in Rational Software Modeler (IBM) allows this "circular reference".
In practice and in trying to map this to Java or other Object languages it may not make sense or get confusing.