Comments (22)
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.
/all/
w1:word
< w2:word
/without/
w1
< word pdp=prep
< w2
/-/
from text-fabric.
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.
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.
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.
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.
---t1
w1:word
< w2:word
---
% other parts of the template
t1
/without/
w1
< word pdp=prep
< w2
/-/
from text-fabric.
So: named subtemplates.
If the quantifier follows the subtemplate immediately, no naming is needed.
from text-fabric.
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.
But in this case we may also say
{
w1:word
< w2:word
}
/without/
w1
< word pdp=prep
< w2
/-/
from text-fabric.
{
and }
should occur on a line on their own, the position in the line does not matter.
from text-fabric.
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.
In other words, what if instead of “quantifiers” or “named templates” we have “blocks”
from text-fabric.
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.
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.
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.
Why do we need the extra /-/ ?
from text-fabric.
This should be possible too:
w1:word
/all/
< w2:word
/without/
< word pdp=prep
< w2
/-/
from text-fabric.
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.
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.
This is a resumption of #9.
from text-fabric.
I am not able to follow this up in the foreseeable future.
from text-fabric.
Related Issues (20)
- Feature comparison for TF-Query HOT 7
- Non-matching template lines HOT 3
- Comments starting after whitespace HOT 1
- Update Software Heritage badge HOT 1
- Add option to manually upload new features HOT 5
- Over-Zealous TF Rate Limit Warning HOT 7
- feature request: plain text show HOT 3
- Better economy with GitHub API requests HOT 2
- bug in defining relations between elements HOT 12
- combining /with/ and relation operators .lex=lex. is not possible HOT 6
- bug in Recorder.read() HOT 2
- Use of Python 3.8 method breaks backwards compatibility by using removeprefix() HOT 7
- Bug in fabric.py when trying to load Tischendorf text HOT 4
- Bug in loading text-fabric 9.0 HOT 4
- bug with the relational operators `<` and `>` when doing feature comparisons `.f<g.` or `.f>g.` HOT 1
- No more app-xxx repositories HOT 4
- EOF error when loading app with Python 3.11 HOT 2
- Undeclared dependency on pandas HOT 3
- internal server error in NER browser when deleting an annotation set HOT 2
- Issue with api HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from text-fabric.