Code Monkey home page Code Monkey logo

Comments (22)

dirkroorda avatar dirkroorda commented on May 17, 2024 1

When I think of it, it should definitely be possible, but there will be an addtional restriction:

  • the stuff between the parent and the quantifier may not contain names from elsewhere in the template

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024 1
/all/
w1:word
< w2:word
/without/
w1
< word pdp=prep
< w2
/-/

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

I see what you mean. Yet it is a lot of work to get it right.
I will not be able to do that in 2018, I'm afraid.
Let's keep it on the list.

from text-fabric.

codykingham avatar codykingham commented on May 17, 2024

Maybe we can think of contextual parentage: the parent node itself comes with its template context. Then TF does not run 2 separate queries from scratch. Could it pass results from a parental template down to a daughter template? Maybe rather than running a second query in the daughter template, you use the first results to narrow the second search. If there is a container relationship expressed, then you can use the container object as a set argument in query 2. If the daughter template goes above the highest object from the mother, you could use an L.u to go straight to the target.

In such a set-up you would probably get better performance, and the inheritance of context would ensure your subtemplates are mutually intelligible. But maybe there are some drawbacks to such an approach?

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

Internally a template is translated into a set of query nodes and query edges, without specific order. That query graph gets executed. At the point of execution there is no indentation and scope anymore.

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

I think the way forward is to let quantifiers quantify not a single parent but a complete subtemplate. The subtemplate must be marked in case if it is more than one parent atom.

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024
---t1
w1:word
< w2:word
---

% other parts of the template

t1
/without/
w1
< word pdp=prep
< w2
/-/

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

So: named subtemplates.
If the quantifier follows the subtemplate immediately, no naming is needed.

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

But wait, the subtemplates might become nested: if they contain quantifiers themselves. So we need a slightly different bracketing syntax:

{t1
w1:word
< w2:word
}

% other parts of the template

t1
/without/
w1
< word pdp=prep
< w2
/-/

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

But in this case we may also say

{
w1:word
< w2:word
}
/without/
w1
< word pdp=prep
< w2
/-/

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

{ and } should occur on a line on their own, the position in the line does not matter.

from text-fabric.

codykingham avatar codykingham commented on May 17, 2024

What if instead of curly braces it were simply the same slashes as a quantifier? It is interesting, though, that we seem to be working back toward a format that looks nearly MQL-like!

from text-fabric.

codykingham avatar codykingham commented on May 17, 2024

In other words, what if instead of “quantifiers” or “named templates” we have “blocks”

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

MQL makes you think about your data as a tree. TF search is more conducive to graph thinking, so I am a bit wary about blocks.

Named templates might be useful as an abbreviation mechanism for reusing bits of template. But that will have complications with names.

About using the /: yes that could be nice. Inner subtemplates should be indented with the quantifier they belong too. Hm: that could be a really nice option.

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

So we only have to add /all/ at the beginning of the template we want to quantify.
It almost sounds doable!

And it sounds right too for all quantifiers:

/all/
things
/where/
these things
/have/
those things
/-/
/all/
things
/with/
these things
/or/
those things
/-/
/all/
things
/without/
them things
/-/

from text-fabric.

codykingham avatar codykingham commented on May 17, 2024

I like that...But maybe the subtemplate should follow an all termination. As it is above, we cannot issue a template on w2 by itself. What about:

/all/
w1:word
< w2: word
/-/
/without/
w1
< word pdp=prep
< w2
/-/

At the same time, these two templates would return identical results:

w1:word
< w2: word
/all/
w1:word
< w2:word
/-/

So the all quantifier is optional, if you want to quantify an entire template you can use it. If not, you can ignore it.

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

Why do we need the extra /-/ ?

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

This should be possible too:

w1:word
/all/
< w2:word
/without/
< word pdp=prep
< w2
/-/

from text-fabric.

codykingham avatar codykingham commented on May 17, 2024

Reason I was thinking the extra ending marker...the diff between this:

/all/
w1:word
< w2:word
/without/
w1
< word pdp=prep
< w2
/-/

and this:

/all/
w1:word
< w2:word
/without/
ls=card
/-/
/without/
w1
< word pdp=prep
< w2
/-/

is a bit subtle. But it does work

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

I think you need an extra /all/ for that.
But I have to admit that I should sleep on this one first

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

This is a resumption of #9.

from text-fabric.

dirkroorda avatar dirkroorda commented on May 17, 2024

I am not able to follow this up in the foreseeable future.

from text-fabric.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.