No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wntr-grammar.owl.txt 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!--
  3. About
  4. ====================
  5. This XML document represents the rule definition of standard English grammar for
  6. Wintermute. This document represents the means of converting linguistics into
  7. ontological information in the English language. God be with us. There's a
  8. document that will be posted to
  9. <http://www.thesii.org/wiki/SII:Projects:Wintermute:LexicalBindings> soon. I
  10. (Jacky Alcine) have to convert the document from ODT to MediaWiki (or if
  11. someone's willing to; e-mail me at jacky.alcine@thesii.org and I'll send it to
  12. you.)
  13. Documentation
  14. ===================
  15. 1. Rule Elements
  16. Rule elements are expected to only have the attribute 'type'. It should contain
  17. ONE (1) type or part of a specific type of node that should match it. In the
  18. future, rules will be allowed (and recommended) to be subset within each other
  19. in order of similiarity (ie: The rule 'A' would contain 'Ad', and 'Ae'. 'Ae'
  20. would contain 'Aen' and 'Aep'). This way, it'd make it possible to enable and
  21. disable certain rules by type.
  22. 2. Bind Elements
  23. Bind elements are perhaps the most cruical and dynamic elements of the RuleSet
  24. document. They're required to have the 'with' attriubte, which specifys what
  25. happens to the nodes before, during, or after linking.
  26. 2a. Pre-link Attributes
  27. These attributes effect the linking process before it happens. Currently, there
  28. aren't any attributes that fall in this category.
  29. 2b. Concurrent Link Attributes
  30. These attribute effect the linking process while it happens.
  31. + linkAction: A list of actions to take place during the linking process. This
  32. attribute can contain a list of values or just one for ease of use. Values
  33. include:
  34. * reverse: This swaps the source node with the destination node and flips
  35. the locale and flags of the link. Used for ontological link simplicity.
  36. * othertype: This sets the flags of the link to the flags of the source
  37. node.
  38. * thistype: This sets the flags of the link to the flags of the destination
  39. node.
  40. 2c. Post-link Attributes
  41. These attributes effect the post results of linking.
  42. + hide: [default = 'no'] Prevents this node (source node) from appearing on
  43. the next round of parsing.
  44. + hideNext: [default = 'no'] Prevents the next node (destination node) from
  45. appearing on its next round of parsing (2 rounds from now).
  46. + skipWord: [default = 'yes'] Doesn't allow the destination node to have a
  47. chance at being parsed.
  48. + hideFilter: [default = ''] Hides a set of words from appearing on the next
  49. round of parsing; a wrapper for the 'hide' attribute.
  50. Changelog
  51. ==================
  52. [#1] (15 Aug 2011 2:26 AM): Biggest issue right now, if there's a rule defined
  53. for 'B' and there's a rule defined for 'Bz' and the node in question *is* 'Bz',
  54. the 'B' rule will have precedence ONLY if it comes before 'Bz' in the document.
  55. At the moment, you must put sub-rules (or rules targeted at specific types of
  56. words) before the general definition.
  57. [#2] (15 Aug 2011 9:51 PM): Fixed issue in changelog entry #1 in script by
  58. using a rating system, but now adjectives don't link to anything after it. This
  59. might be a human or logical error. (APPEND) Yes, it's a logical error, because
  60. when I toggle the 'hide' attribute to 'no' (by deleting it), it generates an
  61. extra, useless link and the whole syntax is messed up. *sigh*
  62. [#3] (15 Aug 2011 11:37 PM): So, the issue in changelog entry #2 was a rule
  63. mistake. Apparently, the generic 'A' rule took over and messed this up. -___-
  64. [#4] (16 Aug 2011 12:18 AM): Incredible progress, the hideFilter attribute now
  65. works to full efficiency. And it really rox!
  66. [#5] (18 Aug 2011 5:37 AM): Was working from late Wednesday evening, will sleep
  67. on this note; specific definitions have to be made for each pronoun; unless the
  68. regex searching gets better.
  69. [#6] (24 Aug 2011 2:03 AM): Spent time re-writing the plug-in system and then
  70. re-writing the ENTIRE model setup from scratch. Soon this'll be
  71. incorporated into the model system. I then implemented a global pseudo node
  72. type (technically it was always there [Bz]). But now, I'm considering allowing
  73. the rule file define a global psuedo type. I already put in the code for it,
  74. but I have to implement the core of the model system for Rules before it can
  75. become useful. I'll take this opporunity to work on the inheritance.
  76. [#7] (24 Aug 2011 7:08 PM): Implemented the code to allow nested rules. Let's
  77. see how this works out.
  78. [#8] (25 Aug 2011 3:05 AM): The recursive rule code has been implemented. Also,
  79. the matching system is stiffer and more exact, it looks for 100% matching and
  80. works its way down, one at a time. I need to figure out to implement a means of
  81. inheriting some binds.
  82. [#9] (27 Aug 2011 5:41 PM) The parser's acting funny, the 'with' property
  83. doesn't get set correctly. EDIT: No worries, it was my miscalibration. It seems
  84. as if now the rule system became more specific. This means that'll take effort
  85. (of course) to get these rules linking properly. Maybe it's time I build the
  86. converter of LinkGrammar's rules for Wintermute. But it stated that it was
  87. designed for newspaper-like text. We want Wintermute to understand sentence
  88. fragments and conversation statements. That'll be in the future, I guess. Now
  89. to the ontology?
  90. [#10] (30 Aug 2011 3:33 AM): Woke up randomly (worried about her being in the ho
  91. spital). But the declaration of Import elements allow a module-like system to lo
  92. ad rules from different sources. Soon, when we learn the RDF syntax, we should
  93. convert this document into something close to it.
  94. -->
  95. <RuleSet locale="en">
  96. <Import uri="verbs.xml" />
  97. <Import uri="adjec.xml" />
  98. <Rule type="A">
  99. <!-- pronouns -->
  100. <Rule type="x">
  101. <Bind with="Bcoapz" has="*" hideNext="yes" skipWord="no" typeHas="*" />
  102. <Bind with="Bcoapz" has="~" hideNext="yes" skipWord="no" typeHas="~" />
  103. </Rule>
  104. <Rule type="r">
  105. <Rule with="e">
  106. <Bind with="E" skipWord="no" />
  107. </Rule>
  108. <Rule type="b">
  109. <Bind with="Ap" has="123*~" skipWord="no" />
  110. <Bind with="Bcoaz" has="*~" hideNext="yes" skipWord="no" />
  111. </Rule>
  112. <Rule type="c">
  113. <Bind with="Craf" has="123*~" skipWord="no" />
  114. </Rule>
  115. </Rule>
  116. <Rule type="e,d">
  117. <Rule type="n,o,p">
  118. <Rule type="*">
  119. <Bind with="Craf" has="1*" linkAction="reverse" typeHas="1*" />
  120. <Bind with="Craf" has="2*" linkAction="reverse" typeHas="2*" />
  121. <Bind with="Craf" has="3*" linkAction="reverse" typeHas="3*" />
  122. </Rule>
  123. <Rule type="~">
  124. <Bind with="Craf" has="1~" linkAction="reverse" typeHas="1~" />
  125. <Bind with="Craf" has="2~" linkAction="reverse" typeHas="2~" />
  126. <Bind with="Craf" has="3~" linkAction="reverse" typeHas="3~" />
  127. </Rule>
  128. </Rule>
  129. </Rule>
  130. <Rule type="p">
  131. <Rule type="x">
  132. </Rule>
  133. </Rule>
  134. </Rule>
  135. <Rule type="B">
  136. <!-- nouns -->
  137. <Bind with="Bpz*~,E,Fm+" skipWord="no" hideNext="yes" />
  138. <Rule type="coa*~">
  139. <Bind with="Craf" hasAll="3~" linkAction="reverse" typeHas="~" />
  140. <Bind with="Craf" hasAll="3*" skipWord="no" linkAction="reverse" typeHas="*" />
  141. </Rule>
  142. <Rule type="p*~">
  143. <Bind with="Craf" hasAll="23~" linkAction="reverse" typeHas="p~" />
  144. <Bind with="Craf" hasAll="23*" skipWord="no" linkAction="reverse" typeHas="p*" />
  145. </Rule>
  146. <Rule type="z">
  147. <Bind with="Craf" has="123*~" skipWord="no" linkAction="reverse" typeHas="z*~" />
  148. <Bind with="Bcoa" has="*~" hideNext="yes" skipWord="no" />
  149. <Bind with="Aednopx" has="*~" />
  150. <Bind with="E" />
  151. <Bind with="Fm+-" skipWord="no"/>
  152. </Rule>
  153. </Rule>
  154. <Rule type="C">
  155. <Rule type="raf">
  156. <Bind with="Bz*~" typeHas="*~" />
  157. <Rule type="*">
  158. <Bind with="Bz" hasAll="*" typeHas="*" />
  159. <Bind with="Bpcoa" hasAll="3*" typeHas="3*" />
  160. <Bind with="Ax" hasAll="*" typeHas="*" />
  161. <Bind with="Aeon" hasAll="1*" typeHas="1*" />
  162. <Bind with="Aeon" hasAll="2*" typeHas="2*" />
  163. <Bind with="Aeon" hasAll="3*" typeHas="3*" />
  164. </Rule>
  165. <Rule type="~">
  166. <Bind with="Bz" hasAll="~" typeHas="~" />
  167. <Bind with="Bpcoa" hasAll="3~" typeHas="3~" />
  168. <Bind with="Ax" hasAll="~" typeHas="~" />
  169. <Bind with="Aeon" hasAll="1~" typeHas="1~" />
  170. <Bind with="Aeon" hasAll="2~" typeHas="2~" />
  171. <Bind with="Aeon" hasAll="3~" typeHas="3~" />
  172. </Rule>
  173. </Rule>
  174. </Rule>
  175. <Rule type="D">
  176. <Bind with="C" />
  177. </Rule>
  178. <Rule type="E">
  179. <Rule with="A,Bcoazp*~" skipWord="no" hideNext="yes" linkAction="reverse,thisType" />
  180. <Rule with="E" />
  181. </Rule>
  182. <Rule type="F">
  183. <Rule with="Aednopx*~,Bcoazp*~" linkAction="reverse,thisType" skipWord="no" hideNext="yes" />
  184. <Rule with="F+" typeHas="-" />
  185. <Rule with="F-" typeHas="+" />
  186. </Rule>
  187. </RuleSet>