Erinevus lehekülje "Derive simple information about Obama" redaktsioonide vahel

Allikas: Kursused
Mine navigeerimisribale Mine otsikasti
(Uus lehekülg: ' Suppose we have a triplet <pre> http://en.wikipedia.org/wiki/Barack_Obama, id:type, http://conceptnet5.media.mit.edu/web/c/en/person </pre> then we encode it in the otter form...')
 
 
(ei näidata sama kasutaja 2 vahepealset redaktsiooni)
16. rida: 16. rida:
 
</pre>
 
</pre>
  
and then we add some of our handmade common-sense rules:
+
and then we add three handmade common-sense taxonomy rules (observe that A->B is equivalent to -A | B)
  
 
<pre>    
 
<pre>    
29. rida: 29. rida:
 
       "mortal").    
 
       "mortal").    
 
      
 
      
  -rdf("http://en.wikipedia.org/wiki/Barack_Obama",
 
      "id:type",
 
      "mortal").  
 
 
 
   -rdf(X,"id:type",
 
   -rdf(X,"id:type",
 
       "http://conceptnet5.media.mit.edu/web/c/en/person") |
 
       "http://conceptnet5.media.mit.edu/web/c/en/person") |
 
     rdf(X,"id:CapableOf",
 
     rdf(X,"id:CapableOf",
       "id:eat").
+
       "id:eat").  
 
+
</pre>
 +
 
 +
The whole problem obama1.txt with the strategy selection and everything, ready to run:
 +
 
 +
<pre>
 +
% clear automatic strategy selection
 +
clear(auto).
 +
 
 +
% use capital letters (A,X,T,...) as vars
 +
set(prolog_style_variables).
 +
 
 +
% select the search strategy
 +
set(hyper_res). % an alternative is to use set(binary_res).
 +
set(factor).
 +
 
 +
% select sensible amount of output
 +
clear(print_given). % uncomment to see input and process
 +
set(print_kept).  % this is important: prints all generated and kept clauses
 +
assign(stats_level, 0).
 +
 
 +
% just make it stop after N secs
 +
assign(max_seconds, 10).
 +
 
 +
list(sos).
 +
 
 +
% example data
 +
 
 +
rdf("http://en.wikipedia.org/wiki/Barack_Obama",
 +
      "id:type",
 +
      "http://conceptnet5.media.mit.edu/web/c/en/person").
 +
     
 +
% some simple taxonomy rules of the form A->B i.e. -A | B in clause form.
 +
 
 +
-rdf(X,"id:type",
 +
    "http://conceptnet5.media.mit.edu/web/c/en/person") |
 +
rdf(X,"id:type",
 +
    "http://conceptnet5.media.mit.edu/web/c/en/animal").
 +
 
 +
-rdf(X,"id:type",
 +
    "http://conceptnet5.media.mit.edu/web/c/en/animal") |
 +
rdf(X,"id:type",
 +
    "mortal").  
 +
   
 +
-rdf(X,"id:type",
 +
    "http://conceptnet5.media.mit.edu/web/c/en/person") |
 +
  rdf(X,"id:CapableOf",
 +
    "id:eat").
 +
 
 +
end_of_list.
 +
</pre>
 +
 
 +
Just send it to otter via standard inpt:
 +
<pre>
 +
otter < obama1.txt
 +
</pre>
 +
 
 +
and look at the **KEPT lines in output.
 +
 
 +
It is a good idea to send the output to a file and then process it later, like this:
 +
 
 +
<pre>
 +
otter < obama1.txt > obama1.out
 
</pre>
 
</pre>

Viimane redaktsioon: 9. november 2015, kell 16:16

Suppose we have a triplet

http://en.wikipedia.org/wiki/Barack_Obama,
id:type,
http://conceptnet5.media.mit.edu/web/c/en/person

then we encode it in the otter format like this:

  
  rdf("http://en.wikipedia.org/wiki/Barack_Obama",
      "id:type",
      "http://conceptnet5.media.mit.edu/web/c/en/person").

and then we add three handmade common-sense taxonomy rules (observe that A->B is equivalent to -A | B)

	  
  -rdf(X,"id:type",
      "http://conceptnet5.media.mit.edu/web/c/en/person") |
   rdf(X,"id:type",
      "http://conceptnet5.media.mit.edu/web/c/en/animal").
	  
   -rdf(X,"id:type",
      "http://conceptnet5.media.mit.edu/web/c/en/animal") |
   rdf(X,"id:type",
      "mortal").	  
  	  
   -rdf(X,"id:type",
      "http://conceptnet5.media.mit.edu/web/c/en/person") |
    rdf(X,"id:CapableOf",
      "id:eat").	  

The whole problem obama1.txt with the strategy selection and everything, ready to run:

% clear automatic strategy selection
clear(auto).

% use capital letters (A,X,T,...) as vars
set(prolog_style_variables).

% select the search strategy
set(hyper_res). % an alternative is to use set(binary_res).
set(factor).

% select sensible amount of output
clear(print_given). % uncomment to see input and process
set(print_kept).  % this is important: prints all generated and kept clauses
assign(stats_level, 0).

% just make it stop after N secs
assign(max_seconds, 10).

list(sos).

% example data

 rdf("http://en.wikipedia.org/wiki/Barack_Obama",
      "id:type",
      "http://conceptnet5.media.mit.edu/web/c/en/person").
      
% some simple taxonomy rules of the form A->B i.e. -A | B in clause form.

-rdf(X,"id:type",
    "http://conceptnet5.media.mit.edu/web/c/en/person") |
 rdf(X,"id:type",
    "http://conceptnet5.media.mit.edu/web/c/en/animal").
  
 -rdf(X,"id:type",
    "http://conceptnet5.media.mit.edu/web/c/en/animal") |
 rdf(X,"id:type",
    "mortal").	  
    
 -rdf(X,"id:type",
    "http://conceptnet5.media.mit.edu/web/c/en/person") |
  rdf(X,"id:CapableOf",
    "id:eat").

end_of_list.

Just send it to otter via standard inpt:

otter < obama1.txt

and look at the **KEPT lines in output.

It is a good idea to send the output to a file and then process it later, like this:

otter < obama1.txt > obama1.out