").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n});
diff --git a/docs/codox/js/page_effects.js b/docs/codox/js/page_effects.js
new file mode 100644
index 0000000..fdacbf8
--- /dev/null
+++ b/docs/codox/js/page_effects.js
@@ -0,0 +1,112 @@
+function visibleInParent(element) {
+ var position = $(element).position().top
+ return position > -50 && position < ($(element).offsetParent().height() - 50)
+}
+
+function hasFragment(link, fragment) {
+ return $(link).attr("href").indexOf("#" + fragment) != -1
+}
+
+function findLinkByFragment(elements, fragment) {
+ return $(elements).filter(function(i, e) { return hasFragment(e, fragment)}).first()
+}
+
+function scrollToCurrentVarLink(elements) {
+ var elements = $(elements);
+ var parent = elements.offsetParent();
+
+ if (elements.length == 0) return;
+
+ var top = elements.first().position().top;
+ var bottom = elements.last().position().top + elements.last().height();
+
+ if (top >= 0 && bottom <= parent.height()) return;
+
+ if (top < 0) {
+ parent.scrollTop(parent.scrollTop() + top);
+ }
+ else if (bottom > parent.height()) {
+ parent.scrollTop(parent.scrollTop() + bottom - parent.height());
+ }
+}
+
+function setCurrentVarLink() {
+ $('.secondary a').parent().removeClass('current')
+ $('.anchor').
+ filter(function(index) { return visibleInParent(this) }).
+ each(function(index, element) {
+ findLinkByFragment(".secondary a", element.id).
+ parent().
+ addClass('current')
+ });
+ scrollToCurrentVarLink('.secondary .current');
+}
+
+var hasStorage = (function() { try { return localStorage.getItem } catch(e) {} }())
+
+function scrollPositionId(element) {
+ var directory = window.location.href.replace(/[^\/]+\.html$/, '')
+ return 'scroll::' + $(element).attr('id') + '::' + directory
+}
+
+function storeScrollPosition(element) {
+ if (!hasStorage) return;
+ localStorage.setItem(scrollPositionId(element) + "::x", $(element).scrollLeft())
+ localStorage.setItem(scrollPositionId(element) + "::y", $(element).scrollTop())
+}
+
+function recallScrollPosition(element) {
+ if (!hasStorage) return;
+ $(element).scrollLeft(localStorage.getItem(scrollPositionId(element) + "::x"))
+ $(element).scrollTop(localStorage.getItem(scrollPositionId(element) + "::y"))
+}
+
+function persistScrollPosition(element) {
+ recallScrollPosition(element)
+ $(element).scroll(function() { storeScrollPosition(element) })
+}
+
+function sidebarContentWidth(element) {
+ var widths = $(element).find('.inner').map(function() { return $(this).innerWidth() })
+ return Math.max.apply(Math, widths)
+}
+
+function calculateSize(width, snap, margin, minimum) {
+ if (width == 0) {
+ return 0
+ }
+ else {
+ return Math.max(minimum, (Math.ceil(width / snap) * snap) + (margin * 2))
+ }
+}
+
+function resizeSidebars() {
+ var primaryWidth = sidebarContentWidth('.primary')
+ var secondaryWidth = 0
+
+ if ($('.secondary').length != 0) {
+ secondaryWidth = sidebarContentWidth('.secondary')
+ }
+
+ // snap to grid
+ primaryWidth = calculateSize(primaryWidth, 32, 13, 160)
+ secondaryWidth = calculateSize(secondaryWidth, 32, 13, 160)
+
+ $('.primary').css('width', primaryWidth)
+ $('.secondary').css('width', secondaryWidth).css('left', primaryWidth + 1)
+
+ if (secondaryWidth > 0) {
+ $('#content').css('left', primaryWidth + secondaryWidth + 2)
+ }
+ else {
+ $('#content').css('left', primaryWidth + 1)
+ }
+}
+
+$(window).ready(resizeSidebars)
+$(window).ready(setCurrentVarLink)
+$(window).ready(function() { persistScrollPosition('.primary')})
+$(window).ready(function() {
+ $('#content').scroll(setCurrentVarLink)
+ $(window).resize(setCurrentVarLink)
+})
diff --git a/docs/codox/wwui.core.html b/docs/codox/wwui.core.html
new file mode 100644
index 0000000..457c841
--- /dev/null
+++ b/docs/codox/wwui.core.html
@@ -0,0 +1,3 @@
+
+
wwui.core documentation wwui.core -main (-main & args)
I don’t do a whole lot … yet.
\ No newline at end of file
diff --git a/docs/codox/wwui.propositions.html b/docs/codox/wwui.propositions.html
new file mode 100644
index 0000000..8e5de29
--- /dev/null
+++ b/docs/codox/wwui.propositions.html
@@ -0,0 +1,9 @@
+
+
wwui.propositions documentation wwui.propositions coll-or-nil? macro (coll-or-nil? o)
grammar
The objective of this grammar is to allow us to take a sequence of tagged symbols, and produce a higher-level tagging of parts of speech, and ultimately propositions, from them.
+
NOTE THAT tags in this grammar are always keywords, to distinguish them from OpenNLP tags, which tag individual tokens and are represented as strings.
identify (identify parse-tree knowledge-accessor)
normalise (normalise parse-tree ka)
propositions (propositions tagged-sentence)
(propositions tagged-sentence knowledge-accessor)
Given a tagged-sentence
, return a list of propositions detected in that sentence; if knowledge-accessor
is passed, try to resolve names and noun phrases to entities known to that knowledge accessor.
+
TODO: Note that if :subject
, :object
or :locator
resolves to multiple objects, then that is essentially one proposition for each unique combination. This is not yet implemented!
propositions-from-file (propositions-from-file file-path)
rdp-extend (rdp-extend tagged-sentence grammar goal)
Seek a phrase which satisfies this goal
(expected to be a collection of tags) in this tagged-sentence
using this grammar
.
+
Return a cons comprising 1. the first matching phrase for the goal, or nil
if no match; 2. the tail of the sentence when the parts comprising the phrase are removed.
rdp-seek (rdp-seek tagged-sentence grammar goal)
Seek a phrase which satisfies this goal
(expected to be a keyword) in this tagged-sentence
using this grammar
.
+
Return a cons comprising 1. the first matching phrase for the goal, tagged with the goal, or nil
if no match; 2. the tail of the sentence when the parts comprising the phrase are removed.
reparse (reparse tagged-sentence grammar goal)
Reparse this tagged-sentence
using this grammar to seek this goal
. Parse greedily, seeking the most extended goal.
+
Return a sequence comprising 1. the first matching phrase for the goal, tagged with the goal, or nil
if no match; 2. the tail of the sentence when the parts comprising the phrase are removed.
+
This function is called reparse
because: 1. it is designed to parse sentences which have already been parsed by OpenNLP: it will not work on raw sentences; 2. it is a recursive descent parser.
tag macro (tag tagged-token)
The tag, on a tagged-token
, is just the second element. Written as a macro for readability.
\ No newline at end of file
diff --git a/project.clj b/project.clj
index 1c9c81e..f598916 100644
--- a/project.clj
+++ b/project.clj
@@ -1,17 +1,23 @@
(defproject wwui "0.1.0-SNAPSHOT"
- :description "Experimental work towards a conversational interface to Wildwood"
- :url "http://example.com/FIXME"
- :license {:name "GNU General Public License,version 2.0 or (at your option) any later version"
- :url "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"}
+ :cloverage {:output "docs/cloverage"}
+ :codox {:metadata {:doc "**TODO**: write docs"
+ :doc/format :markdown}
+ :output-path "docs/codox"
+ :source-uri "https://github.com/simon-brooke/wwui/blob/master/{filepath}#L{line}"}
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/math.combinatorics "0.1.6"]
[clojure-opennlp "0.5.0"]
[com.taoensso/timbre "4.10.0"]
[wildwood "0.1.0-SNAPSHOT"]]
+ :description "Experimental work towards a conversational interface to Wildwood"
+ :license {:name "GNU General Public License,version 2.0 or (at your option) any later version"
+ :url "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"}
:main ^:skip-aot wwui.core
- :target-path "target/%s"
:plugins [[lein-cloverage "1.1.1"]
[lein-codox "0.10.7"]
[lein-cucumber "1.0.2"]
[lein-gorilla "0.4.0"]]
- :profiles {:uberjar {:aot :all}})
+ :profiles {:uberjar {:aot :all}}
+ :target-path "target/%s"
+ :url "http://example.com/FIXME"
+ )