You might want to consider the start of this tutorial.
Short introductions to other TF datasets:
or the
%load_ext autoreload
%autoreload 2
from tf.app import use
A = use("ETCBC/bhsa", hoist=globals())
This is Text-Fabric 9.3.2 Api reference : https://annotation.github.io/text-fabric/tf/cheatsheet.html 122 features found and 0 ignored
There are relationship between objects that are about their identities, the way they occupy space, and the way they are connected.
Are two objects the same, do they occupy the same slots, do they overlap, is one embedded in the other, does one come before the other? Is there an edge from one to another?
Although these relationships are easy to define, and even easy to implement, they may be very costly to use. When searching, most of them have to be computed very many times.
Some of them have been precomputed and stored in an index, e.g. the embedding relationships. They can be used without penalty.
Other relations are not suitable for pre-computing: most inequality relations are of that kind. It would require an enormous amount of storage to pre-compute for each node the set of nodes that occupy different slots. This type of relation will not be used in narrowing down the search space, which means that it may take more time to get the results.
We are going to test all of our relationships here.
Let us first see what relationships we have:
S.relationsLegend()
= left equal to right (as node) # left unequal to right (as node) < left before right (in canonical node ordering) > left after right (in canonical node ordering) == left occupies same slots as right && left has overlapping slots with right ## left and right do not have the same slot set || left and right do not have common slots [[ left embeds right ]] left embedded in right << left completely before right >> left completely after right =: left and right start at the same slot := left and right end at the same slot :: left and right start and end at the same slot <: left immediately before right :> left immediately after right =k: left and right start at k-nearly the same slot :k= left and right end at k-nearly the same slot :k: left and right start and end at k-near slots <k: left k-nearly before right :k> left k-nearly after right .f. left.f = right.f .f=g. left.f = right.g .f~r~g. left.f matches right.g .f#g. left.f # right.g .f>g. left.f > right.g .f<g. left.f < right.g -crossref> edge feature "crossref" with value specification allowed <crossref- edge feature "crossref" with value specification allowed (opposite direction) <crossref> edge feature "crossref" with value specification allowed (either direction) -crossrefLCS> edge feature "crossrefLCS" with value specification allowed <crossrefLCS- edge feature "crossrefLCS" with value specification allowed (opposite direction) <crossrefLCS> edge feature "crossrefLCS" with value specification allowed (either direction) -crossrefSET> edge feature "crossrefSET" with value specification allowed <crossrefSET- edge feature "crossrefSET" with value specification allowed (opposite direction) <crossrefSET> edge feature "crossrefSET" with value specification allowed (either direction) -distributional_parent> edge feature "distributional_parent" <distributional_parent- edge feature "distributional_parent" (opposite direction) <distributional_parent> edge feature "distributional_parent" (either direction) -functional_parent> edge feature "functional_parent" <functional_parent- edge feature "functional_parent" (opposite direction) <functional_parent> edge feature "functional_parent" (either direction) -mother> edge feature "mother" <mother- edge feature "mother" (opposite direction) <mother> edge feature "mother" (either direction) -omap@2017-2021> edge feature "omap@2017-2021" with value specification allowed <omap@2017-2021- edge feature "omap@2017-2021" with value specification allowed (opposite direction) <omap@2017-2021> edge feature "omap@2017-2021" with value specification allowed (either direction) -omap@c-2021> edge feature "omap@c-2021" with value specification allowed <omap@c-2021- edge feature "omap@c-2021" with value specification allowed (opposite direction) <omap@c-2021> edge feature "omap@c-2021" with value specification allowed (either direction) The warp feature "oslots" cannot be used in searches. One of the above relations on nodes and/or slots will suit you better.
The top of the list are identity and spatial relationships. We are going to discuss them. They are documented in relationships
The bottom of the list are relationships defined by the edge features of your dataset. We have discussed them in advanced.
query = """
v1:verse
sentence
clause rela=Objc
phrase
word sp=verb gn=f nu=pl
v2:verse
sentence
c1:clause
c2:clause
c3:clause
c1 < c2
c2 < c3
v1 = v2
"""
results = A.search(query)
0.39s 48 results
We show the results with the first clause in magenta and the second sentence in cyan.
Note that the first and the second sentence may be the same sentence!
And observe that the last clause is the same one as the first one, hence they have the same color.
skipCols = "1 6" # the verses
colorMap = {2: "magenta", 6: "cyan"}
A.table(results, end=1, colorMap=colorMap, skipCols=skipCols)
n | p | sentence | clause | phrase | word | sentence | clause | clause | clause |
---|---|---|---|---|---|---|---|---|---|
1 | Jeremiah 44:15 | וַיַּעֲנ֣וּ אֶֽת־יִרְמְיָ֗הוּ כָּל־הָאֲנָשִׁ֤ים הַיֹּֽדְעִים֙ כִּֽי־מְקַטְּרֹ֤ות נְשֵׁיהֶם֙ לֵאלֹהִ֣ים אֲחֵרִ֔ים וְכָל־הַנָּשִׁ֥ים הָעֹמְדֹ֖ות קָהָ֣ל גָּדֹ֑ול וְכָל־הָעָ֛ם הַיֹּשְׁבִ֥ים בְּאֶֽרֶץ־מִצְרַ֖יִם בְּפַתְרֹ֥וס לֵאמֹֽר׃ | כִּֽי־מְקַטְּרֹ֤ות נְשֵׁיהֶם֙ לֵאלֹהִ֣ים אֲחֵרִ֔ים | מְקַטְּרֹ֤ות | מְקַטְּרֹ֤ות | וַיַּעֲנ֣וּ אֶֽת־יִרְמְיָ֗הוּ כָּל־הָאֲנָשִׁ֤ים הַיֹּֽדְעִים֙ כִּֽי־מְקַטְּרֹ֤ות נְשֵׁיהֶם֙ לֵאלֹהִ֣ים אֲחֵרִ֔ים וְכָל־הַנָּשִׁ֥ים הָעֹמְדֹ֖ות קָהָ֣ל גָּדֹ֑ול וְכָל־הָעָ֛ם הַיֹּשְׁבִ֥ים בְּאֶֽרֶץ־מִצְרַ֖יִם בְּפַתְרֹ֥וס לֵאמֹֽר׃ | וַיַּעֲנ֣וּ אֶֽת־יִרְמְיָ֗הוּ כָּל־הָאֲנָשִׁ֤ים וְכָל־הַנָּשִׁ֥ים קָהָ֣ל גָּדֹ֑ול וְכָל־הָעָ֛ם | הַיֹּֽדְעִים֙ | כִּֽי־מְקַטְּרֹ֤ות נְשֵׁיהֶם֙ לֵאלֹהִ֣ים אֲחֵרִ֔ים |
A.show(results, end=1, colorMap=colorMap, skipCols=skipCols)
result 1
n # m
if n
and m
are not the same node.
If you write a template, and you know that one node should come before another one,
consider using <
or >
, which will constrain the results better.
We have seen this in action in the search for gapped phrases.
<
and >
canonical order¶n < m
if n
comes before m
in the
canonical ordering
of nodes.
We have seen them in action before.
We show that the following relationships also work with custom sets, as introduced in the search Advanced tutorial.
We make two custom sets, common
and rare
, consisting of nodes whose contained slots have all
common lexemes or some rare lexemes, like we did in
search Advanced.
COMMON_RANK = 100
RARE_RANK = 500
common = set()
rare = set()
for n in N.walk():
nTp = F.otype.v(n)
if nTp == "lex":
continue
if nTp == "word":
ranks = [F.rank_lex.v(n)]
else:
ranks = [F.rank_lex.v(w) for w in L.d(n, otype="word")]
maxRank = max(ranks)
minRank = min(ranks)
if maxRank < COMMON_RANK:
common.add(n)
if maxRank > RARE_RANK:
rare.add(n)
print(f"{len(common):>6} members in set common")
print(f"{len(rare):>6} members in set rare")
669195 members in set common 425320 members in set rare
Now we can do all kinds of searches within the domain of common
and rare
things.
We give the names to all the sets and put them in a dictionary.
customSets = dict(
common=common,
rare=rare,
)
Expert remark
Note that these sets contain both slot nodes and non-slot nodes. The code that implements the basic relationship is heavily optimized and contains case distinctions as to whether nodes are slot or non-slot. For ordinary node types, it is clear on beforehand whether its nodes are slot or non-slot, but custom sets may contain both.
So our frequent
and infrequent
sets are good tests whether the basic relationships are correctly implemented.
==
same slots¶Two objects are extensionally equal if they occupy exactly the same slots.
query = """
v:verse
s:sentence
v == s
"""
results = A.search(query)
0.16s 3583 results
A.table(results, end=7, skipCols="1")
A.show(results, start=1, end=1, skipCols="1")
n | p | sentence |
---|---|---|
1 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ |
2 | Genesis 1:16 | וַיַּ֣עַשׂ אֱלֹהִ֔ים אֶת־שְׁנֵ֥י הַמְּאֹרֹ֖ת הַגְּדֹלִ֑ים אֶת־הַמָּאֹ֤ור הַגָּדֹל֙ לְמֶמְשֶׁ֣לֶת הַיֹּ֔ום וְאֶת־הַמָּאֹ֤ור הַקָּטֹן֙ לְמֶמְשֶׁ֣לֶת הַלַּ֔יְלָה וְאֵ֖ת הַכֹּוכָבִֽים׃ |
3 | Genesis 2:1 | וַיְכֻלּ֛וּ הַשָּׁמַ֥יִם וְהָאָ֖רֶץ וְכָל־צְבָאָֽם׃ |
4 | Genesis 2:9 | וַיַּצְמַ֞ח יְהוָ֤ה אֱלֹהִים֙ מִן־הָ֣אֲדָמָ֔ה כָּל־עֵ֛ץ נֶחְמָ֥ד לְמַרְאֶ֖ה וְטֹ֣וב לְמַאֲכָ֑ל וְעֵ֤ץ הַֽחַיִּים֙ בְּתֹ֣וךְ הַגָּ֔ן וְעֵ֕ץ הַדַּ֖עַת טֹ֥וב וָרָֽע׃ |
5 | Genesis 3:5 | כִּ֚י יֹדֵ֣עַ אֱלֹהִ֔ים כִּ֗י בְּיֹום֙ אֲכָלְכֶ֣ם מִמֶּ֔נּוּ וְנִפְקְח֖וּ עֵֽינֵיכֶ֑ם וִהְיִיתֶם֙ כֵּֽאלֹהִ֔ים יֹדְעֵ֖י טֹ֥וב וָרָֽע׃ |
6 | Genesis 3:23 | וַֽיְשַׁלְּחֵ֛הוּ יְהוָ֥ה אֱלֹהִ֖ים מִגַּן־עֵ֑דֶן לַֽעֲבֹד֙ אֶת־הָ֣אֲדָמָ֔ה אֲשֶׁ֥ר לֻקַּ֖ח מִשָּֽׁם׃ |
7 | Genesis 4:24 | כִּ֥י שִׁבְעָתַ֖יִם יֻקַּם־קָ֑יִן וְלֶ֖מֶךְ שִׁבְעִ֥ים וְשִׁבְעָֽה׃ |
result 1
Now a similar query with the custom sets:
query = """
v:common otype=verse
s:common otype=sentence
v == s
"""
resultsCustom = A.search(query, sets=customSets)
A.table(resultsCustom, end=10, skipCols="1")
A.show(resultsCustom, start=1, end=1, skipCols="1")
0.54s 135 results
n | p | sentence |
---|---|---|
1 | Exodus 6:10 | וַיְדַבֵּ֥ר יְהוָ֖ה אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ |
2 | Exodus 6:28 | וַיְהִ֗י בְּיֹ֨ום דִּבֶּ֧ר יְהוָ֛ה אֶל־מֹשֶׁ֖ה בְּאֶ֥רֶץ מִצְרָֽיִם׃ פ |
3 | Exodus 13:1 | וַיְדַבֵּ֥ר יְהוָ֖ה אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ |
4 | Exodus 14:1 | וַיְדַבֵּ֥ר יְהֹוָ֖ה אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ |
5 | Exodus 16:11 | וַיְדַבֵּ֥ר יְהוָ֖ה אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ |
6 | Exodus 20:1 | וַיְדַבֵּ֣ר אֱלֹהִ֔ים אֵ֛ת כָּל־הַדְּבָרִ֥ים הָאֵ֖לֶּה לֵאמֹֽר׃ ס |
7 | Exodus 25:1 | וַיְדַבֵּ֥ר יְהוָ֖ה אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ |
8 | Exodus 30:11 | וַיְדַבֵּ֥ר יְהוָ֖ה אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ |
9 | Exodus 30:17 | וַיְדַבֵּ֥ר יְהוָ֖ה אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ |
10 | Exodus 30:22 | וַיְדַבֵּ֥ר יְהוָ֖ה אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ |
result 1
As a check we compute manually the maximum rank of the lexemes in the clauses yielded by the query without the custom sets:
rejected = 0
for (verse, sentence) in results:
maxRank = max(F.rank_lex.v(w) for w in L.d(verse, otype="word"))
if maxRank >= COMMON_RANK:
rejected += 1
print(f"Rejected {rejected} non-common results, leaving {len(results) - rejected} ones")
Rejected 3448 non-common results, leaving 135 ones
&&
overlap¶Two objects overlap if and only if they share at least one slot. This is quite costly to use in some cases.
We are going to find the sentences that overlap with two verses.
query = """
sentence
/with/
v1:verse
&& ..
v2:verse
&& ..
v1 < v2
/-/
"""
Explanation: the query looks for sentences and delivers results that are tuples with only a sentence node.
This is because the stuff within the /with/
quantifier does not contribute to the result tuples.
The /with/
quantifier poses a few restrictions on its parent, the sentence
.
From within the quantifier you can refer to the parent by ..
.
The condition is that there are verses v1
and v2
that have overlap with the sentence, and that v1
comes before v2
.
The result is a tuple of exactly the sentences that span multiple verses.
results = A.search(query)
0.58s 887 results
A.table(results, end=5)
A.show(results, condensed=False, baseTypes="clause", start=1, end=3)
n | p | sentence |
---|---|---|
1 | Genesis 1:17 | וַיִּתֵּ֥ן אֹתָ֛ם אֱלֹהִ֖ים בִּרְקִ֣יעַ הַשָּׁמָ֑יִם לְהָאִ֖יר עַל־הָאָֽרֶץ׃ וְלִמְשֹׁל֙ בַּיֹּ֣ום וּבַלַּ֔יְלָה וּֽלֲהַבְדִּ֔יל בֵּ֥ין הָאֹ֖ור וּבֵ֣ין הַחֹ֑שֶׁךְ |
2 | Genesis 1:29 | הִנֵּה֩ נָתַ֨תִּי לָכֶ֜ם אֶת־כָּל־עֵ֣שֶׂב׀ זֹרֵ֣עַ זֶ֗רַע אֲשֶׁר֙ עַל־פְּנֵ֣י כָל־הָאָ֔רֶץ וְאֶת־כָּל־הָעֵ֛ץ אֲשֶׁר־בֹּ֥ו פְרִי־עֵ֖ץ זֹרֵ֣עַ זָ֑רַע וּֽלְכָל־חַיַּ֣ת הָ֠אָרֶץ וּלְכָל־עֹ֨וף הַשָּׁמַ֜יִם וּלְכֹ֣ל׀ רֹומֵ֣שׂ עַל־הָאָ֗רֶץ אֲשֶׁר־בֹּו֙ נֶ֣פֶשׁ חַיָּ֔ה אֶת־כָּל־יֶ֥רֶק עֵ֖שֶׂב לְאָכְלָ֑ה |
3 | Genesis 2:4 | בְּיֹ֗ום עֲשֹׂ֛ות יְהוָ֥ה אֱלֹהִ֖ים אֶ֥רֶץ וְשָׁמָֽיִם׃ וַיִּיצֶר֩ יְהוָ֨ה אֱלֹהִ֜ים אֶת־הָֽאָדָ֗ם עָפָר֙ מִן־הָ֣אֲדָמָ֔ה |
4 | Genesis 7:2 | מִכֹּ֣ל׀ הַבְּהֵמָ֣ה הַטְּהֹורָ֗ה תִּֽקַּח־לְךָ֛ שִׁבְעָ֥ה שִׁבְעָ֖ה אִ֣ישׁ וְאִשְׁתֹּ֑ו וּמִן־הַבְּהֵמָ֡ה אֲ֠שֶׁר לֹ֣א טְהֹרָ֥ה הִ֛וא שְׁנַ֖יִם אִ֥ישׁ וְאִשְׁתֹּֽו׃ גַּ֣ם מֵעֹ֧וף הַשָּׁמַ֛יִם שִׁבְעָ֥ה שִׁבְעָ֖ה זָכָ֣ר וּנְקֵבָ֑ה לְחַיֹּ֥ות זֶ֖רַע עַל־פְּנֵ֥י כָל־הָאָֽרֶץ׃ |
5 | Genesis 7:8 | מִן־הַבְּהֵמָה֙ הַטְּהֹורָ֔ה וּמִן־הַ֨בְּהֵמָ֔ה אֲשֶׁ֥ר אֵינֶ֖נָּה טְהֹרָ֑ה וּמִ֨ן־הָעֹ֔וף וְכֹ֥ל אֲשֶׁר־רֹמֵ֖שׂ עַל־הָֽאֲדָמָֽה׃ שְׁנַ֨יִם שְׁנַ֜יִם בָּ֧אוּ אֶל־נֹ֛חַ אֶל־הַתֵּבָ֖ה זָכָ֣ר וּנְקֵבָ֑ה כַּֽאֲשֶׁ֛ר צִוָּ֥ה אֱלֹהִ֖ים אֶת־נֹֽחַ׃ |
result 1
result 2
result 3
Now with custom sets:
query = """
common otype=sentence
/with/
v1:verse
&& ..
v2:verse
&& ..
v1 < v2
/-/
"""
resultsCommon = A.search(query, sets=customSets)
0.50s 6 results
A.table(resultsCommon)
n | p | sentence |
---|---|---|
1 | Numbers 27:8 | אִ֣ישׁ כִּֽי־יָמ֗וּת וּבֵן֙ אֵ֣ין לֹ֔ו וְאִם־אֵ֥ין לֹ֖ו בַּ֑ת וְאִם־אֵ֥ין לֹ֖ו אַחִ֑ים וְאִם־אֵ֣ין אַחִים֮ לְאָבִיו֒ |
2 | Jeremiah 7:24 | וְלֹ֤א שָֽׁמְעוּ֙ לְמִן־הַיֹּ֗ום אֲשֶׁ֨ר יָצְא֤וּ אֲבֹֽותֵיכֶם֙ מֵאֶ֣רֶץ מִצְרַ֔יִם עַ֖ד הַיֹּ֣ום הַזֶּ֑ה |
3 | Jeremiah 21:8 | וְאֶל־הָעָ֤ם הַזֶּה֙ תֹּאמַ֔ר וּלְבֵית֙ מֶ֣לֶךְ יְהוּדָ֔ה |
4 | Jeremiah 21:11 | שִׁמְע֖וּ דְּבַר־יְהוָֽה׃ בֵּ֣ית דָּוִ֗ד |
5 | Ezekiel 37:18 | וְכַֽאֲשֶׁר֙ יֹאמְר֣וּ אֵלֶ֔יךָ בְּנֵ֥י עַמְּךָ֖ לֵאמֹ֑ר דַּבֵּ֣ר אֲלֵהֶ֗ם |
6 | Psalms 25:1 | אֵלֶ֥יךָ יְ֝הוָ֗ה נַפְשִׁ֥י אֶשָּֽׂא׃ אֱֽלֹהַ֗י |
The following query has the same results but is less insightful.
query = """
sentence
=: w1:word
w2:word
:=
v1:verse
wv1:word
v2:verse
wv2:word
w1 = wv1
w2 = wv2
v1 < v2
"""
fastResults = A.search(query)
0.95s 887 results
sorted((x[0],) for x in fastResults) == sorted(results)
True
##
not the same slots¶True when the two objects in question do not occupy exactly the same set of slots. This is a very loose relationship.
We look for sentences that start with a sentence atom that is not co-extensive with its sentence.
query = """
s:sentence
=: sa:sentence_atom
s ## sa
"""
results = A.search(query)
A.table(results, end=5)
A.show(results, baseTypes="phrase", start=1, end=1)
0.11s 702 results
n | p | sentence | sentence_atom |
---|---|---|---|
1 | Genesis 1:29 | הִנֵּה֩ נָתַ֨תִּי לָכֶ֜ם אֶת־כָּל־עֵ֣שֶׂב׀ זֹרֵ֣עַ זֶ֗רַע אֲשֶׁר֙ עַל־פְּנֵ֣י כָל־הָאָ֔רֶץ וְאֶת־כָּל־הָעֵ֛ץ אֲשֶׁר־בֹּ֥ו פְרִי־עֵ֖ץ זֹרֵ֣עַ זָ֑רַע וּֽלְכָל־חַיַּ֣ת הָ֠אָרֶץ וּלְכָל־עֹ֨וף הַשָּׁמַ֜יִם וּלְכֹ֣ל׀ רֹומֵ֣שׂ עַל־הָאָ֗רֶץ אֲשֶׁר־בֹּו֙ נֶ֣פֶשׁ חַיָּ֔ה אֶת־כָּל־יֶ֥רֶק עֵ֖שֶׂב לְאָכְלָ֑ה | הִנֵּה֩ נָתַ֨תִּי לָכֶ֜ם אֶת־כָּל־עֵ֣שֶׂב׀ זֹרֵ֣עַ זֶ֗רַע אֲשֶׁר֙ עַל־פְּנֵ֣י כָל־הָאָ֔רֶץ וְאֶת־כָּל־הָעֵ֛ץ אֲשֶׁר־בֹּ֥ו פְרִי־עֵ֖ץ זֹרֵ֣עַ זָ֑רַע |
2 | Genesis 2:4 | בְּיֹ֗ום עֲשֹׂ֛ות יְהוָ֥ה אֱלֹהִ֖ים אֶ֥רֶץ וְשָׁמָֽיִם׃ וַיִּיצֶר֩ יְהוָ֨ה אֱלֹהִ֜ים אֶת־הָֽאָדָ֗ם עָפָר֙ מִן־הָ֣אֲדָמָ֔ה | בְּיֹ֗ום עֲשֹׂ֛ות יְהוָ֥ה אֱלֹהִ֖ים אֶ֥רֶץ וְשָׁמָֽיִם׃ |
3 | Genesis 3:3 | וּמִפְּרִ֣י הָעֵץ֮ אֲשֶׁ֣ר בְּתֹוךְ־הַגָּן֒ לֹ֤א תֹֽאכְלוּ֙ מִמֶּ֔נּוּ | וּמִפְּרִ֣י הָעֵץ֮ אֲשֶׁ֣ר בְּתֹוךְ־הַגָּן֒ |
4 | Genesis 13:1 | וַיַּעַל֩ אַבְרָ֨ם מִמִּצְרַ֜יִם ה֠וּא וְאִשְׁתֹּ֧ו וְכָל־אֲשֶׁר־לֹ֛ו הַנֶּֽגְבָּה׃ | וַיַּעַל֩ אַבְרָ֨ם מִמִּצְרַ֜יִם ה֠וּא וְאִשְׁתֹּ֧ו וְכָל־אֲשֶׁר־לֹ֛ו |
5 | Genesis 13:9 | הִפָּ֥רֶד נָ֖א מֵעָלָ֑י אִם־הַשְּׂמֹ֣אל וְאִם־הַיָּמִ֖ין | הִפָּ֥רֶד נָ֖א מֵעָלָ֑י אִם־הַשְּׂמֹ֣אל |
result 1
Now in the common domain.
query = """
s:common otype=sentence
=: sa:sentence_atom
s ## sa
"""
resultsCustom = A.search(query, sets=customSets)
A.table(resultsCustom, end=5)
A.show(resultsCustom, baseTypes="phrase", start=1, end=1)
0.30s 20 results
n | p | sentence | sentence_atom |
---|---|---|---|
1 | Numbers 23:19 | הַה֤וּא אָמַר֙ וְדִבֶּ֖ר | הַה֤וּא אָמַר֙ |
2 | Numbers 27:8 | אִ֣ישׁ כִּֽי־יָמ֗וּת וּבֵן֙ אֵ֣ין לֹ֔ו וְאִם־אֵ֥ין לֹ֖ו בַּ֑ת וְאִם־אֵ֥ין לֹ֖ו אַחִ֑ים וְאִם־אֵ֣ין אַחִים֮ לְאָבִיו֒ | אִ֣ישׁ כִּֽי־יָמ֗וּת וּבֵן֙ אֵ֣ין לֹ֔ו |
3 | Judges 7:4 | אֲשֶׁר֩ אֹמַ֨ר אֵלֶ֜יךָ ה֚וּא יֵלֵ֣ךְ אִתָּ֔ךְ | אֲשֶׁר֩ אֹמַ֨ר אֵלֶ֜יךָ |
4 | Judges 7:4 | וְכֹ֨ל אֲשֶׁר־אֹמַ֜ר אֵלֶ֗יךָ ה֖וּא לֹ֥א יֵלֵֽךְ׃ | וְכֹ֨ל אֲשֶׁר־אֹמַ֜ר אֵלֶ֗יךָ |
5 | 2_Samuel 5:6 | וַיֹּ֨אמֶר לְדָוִ֤ד לֵאמֹר֙ לֵאמֹ֔ר | וַיֹּ֨אמֶר לְדָוִ֤ד לֵאמֹר֙ |
result 1
query = """
p:phrase
s1:subphrase
< s2:subphrase
s1 || s2
"""
results = A.search(query)
A.table(results, end=7)
A.show(results, start=1, end=1)
0.67s 168504 results
n | p | phrase | subphrase | subphrase |
---|---|---|---|---|
1 | Genesis 1:1 | אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | אֵ֥ת הַשָּׁמַ֖יִם | אֵ֥ת הָאָֽרֶץ׃ |
2 | Genesis 1:2 | תֹ֨הוּ֙ וָבֹ֔הוּ | תֹ֨הוּ֙ | בֹ֔הוּ |
3 | Genesis 1:2 | עַל־פְּנֵ֣י תְהֹ֑ום | פְּנֵ֣י | תְהֹ֑ום |
4 | Genesis 1:2 | ר֣וּחַ אֱלֹהִ֔ים | ר֣וּחַ | אֱלֹהִ֔ים |
5 | Genesis 1:2 | עַל־פְּנֵ֥י הַמָּֽיִם׃ | פְּנֵ֥י | הַמָּֽיִם׃ |
6 | Genesis 1:4 | בֵּ֥ין הָאֹ֖ור וּבֵ֥ין הַחֹֽשֶׁךְ׃ | בֵּ֥ין הָאֹ֖ור | בֵ֥ין הַחֹֽשֶׁךְ׃ |
7 | Genesis 1:5 | יֹ֥ום אֶחָֽד׃ פ | יֹ֥ום | אֶחָֽד׃ פ |
result 1
Now in the common domain.
query = """
p:common otype=phrase
s1:subphrase
< s2:subphrase
s1 || s2
"""
resultsCustom = A.search(query, sets=customSets)
A.table(resultsCustom, end=7)
A.show(resultsCustom, start=1, end=1)
0.42s 10999 results
n | p | phrase | subphrase | subphrase |
---|---|---|---|---|
1 | Genesis 1:2 | עַל־פְּנֵ֥י הַמָּֽיִם׃ | פְּנֵ֥י | הַמָּֽיִם׃ |
2 | Genesis 1:5 | יֹ֥ום אֶחָֽד׃ פ | יֹ֥ום | אֶחָֽד׃ פ |
3 | Genesis 1:29 | עַל־פְּנֵ֣י כָל־הָאָ֔רֶץ | פְּנֵ֣י | כָל־הָאָ֔רֶץ |
4 | Genesis 1:29 | עַל־פְּנֵ֣י כָל־הָאָ֔רֶץ | פְּנֵ֣י | כָל־ |
5 | Genesis 1:29 | עַל־פְּנֵ֣י כָל־הָאָ֔רֶץ | פְּנֵ֣י | הָאָ֔רֶץ |
6 | Genesis 1:29 | עַל־פְּנֵ֣י כָל־הָאָ֔רֶץ | כָל־ | הָאָ֔רֶץ |
7 | Genesis 2:4 | יְהוָ֥ה אֱלֹהִ֖ים | יְהוָ֥ה | אֱלֹהִ֖ים |
result 1
We see that Genesis 1:1 has fallen out. Let's check the ranks of the lexemes of its last phrase:
firstSentence = F.otype.s("sentence")[0]
lastPhrase = L.d(firstSentence, otype="phrase")[-1]
[(F.g_word_utf8.v(w), F.rank_lex.v(w)) for w in L.d(lastPhrase, otype="word")]
[('אֵ֥ת', 4), ('הַ', 1), ('שָּׁמַ֖יִם', 122), ('וְ', 0), ('אֵ֥ת', 4), ('הָ', 1), ('אָֽרֶץ', 22)]
There you have it: the heavens are rare!
[[
and ]]
embedding¶n [[ m
if object n
embeds m
.
n ]] m
if object n
lies embedded in m
.
These relations are used implicitly in templates when there is indentation:
s:sentence
p:phrase
w1:word gn=f
w2:word gn=m
The template above implicitly states the following embeddings:
s ]] p
p ]] w1
p ]] w2
We have seen these relations in action.
query = """
sentence
c1:clause
p:phrase
c2:clause
c1 << p
c2 >> p
"""
results = A.search(query)
colorMap = {2: "lightyellow", 3: "cyan", 4: "magenta", 5: "blue"}
A.table(results, end=5, baseTypes="phrase", colorMap=colorMap)
A.show(results, condensed=False, baseTypes="phrase", start=1, end=1, colorMap=colorMap)
1.62s 136137 results
n | p | sentence | clause | phrase | clause |
---|---|---|---|---|---|
1 | Genesis 1:11 | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב מַזְרִ֣יעַ זֶ֔רַע עֵ֣ץ פְּרִ֞י עֹ֤שֶׂה פְּרִי֙ לְמִינֹ֔ו אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו עַל־הָאָ֑רֶץ | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב עֵ֣ץ פְּרִ֞י | עֹ֤שֶׂה | אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו |
2 | Genesis 1:11 | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב מַזְרִ֣יעַ זֶ֔רַע עֵ֣ץ פְּרִ֞י עֹ֤שֶׂה פְּרִי֙ לְמִינֹ֔ו אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו עַל־הָאָ֑רֶץ | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב עֵ֣ץ פְּרִ֞י | פְּרִי֙ | אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו |
3 | Genesis 1:11 | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב מַזְרִ֣יעַ זֶ֔רַע עֵ֣ץ פְּרִ֞י עֹ֤שֶׂה פְּרִי֙ לְמִינֹ֔ו אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו עַל־הָאָ֑רֶץ | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב עֵ֣ץ פְּרִ֞י | לְמִינֹ֔ו | אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו |
4 | Genesis 1:11 | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב מַזְרִ֣יעַ זֶ֔רַע עֵ֣ץ פְּרִ֞י עֹ֤שֶׂה פְּרִי֙ לְמִינֹ֔ו אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו עַל־הָאָ֑רֶץ | מַזְרִ֣יעַ זֶ֔רַע | עֹ֤שֶׂה | אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו |
5 | Genesis 1:11 | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב מַזְרִ֣יעַ זֶ֔רַע עֵ֣ץ פְּרִ֞י עֹ֤שֶׂה פְּרִי֙ לְמִינֹ֔ו אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו עַל־הָאָ֑רֶץ | מַזְרִ֣יעַ זֶ֔רַע | פְּרִי֙ | אֲשֶׁ֥ר זַרְעֹו־בֹ֖ו |
result 1
In the common domain:
query = """
sentence
c1:common otype=clause
p:rare otype=phrase
c2:common otype=clause
c1 << p
c2 >> p
"""
resultsCustom = A.search(query, sets=customSets)
A.table(resultsCustom, end=5, baseTypes="phrase", colorMap=colorMap)
A.show(
resultsCustom,
condensed=False,
baseTypes="phrase",
start=1,
end=1,
colorMap=colorMap,
)
0.81s 509 results
n | p | sentence | clause | phrase | clause |
---|---|---|---|---|---|
1 | Genesis 3:5 | כִּ֚י יֹדֵ֣עַ אֱלֹהִ֔ים כִּ֗י בְּיֹום֙ אֲכָלְכֶ֣ם מִמֶּ֔נּוּ וְנִפְקְח֖וּ עֵֽינֵיכֶ֑ם וִהְיִיתֶם֙ כֵּֽאלֹהִ֔ים יֹדְעֵ֖י טֹ֥וב וָרָֽע׃ | כִּ֚י יֹדֵ֣עַ אֱלֹהִ֔ים | נִפְקְח֖וּ | וִהְיִיתֶם֙ כֵּֽאלֹהִ֔ים |
2 | Genesis 3:5 | כִּ֚י יֹדֵ֣עַ אֱלֹהִ֔ים כִּ֗י בְּיֹום֙ אֲכָלְכֶ֣ם מִמֶּ֔נּוּ וְנִפְקְח֖וּ עֵֽינֵיכֶ֑ם וִהְיִיתֶם֙ כֵּֽאלֹהִ֔ים יֹדְעֵ֖י טֹ֥וב וָרָֽע׃ | כִּ֗י בְּיֹום֙ | נִפְקְח֖וּ | וִהְיִיתֶם֙ כֵּֽאלֹהִ֔ים |
3 | Genesis 3:5 | כִּ֚י יֹדֵ֣עַ אֱלֹהִ֔ים כִּ֗י בְּיֹום֙ אֲכָלְכֶ֣ם מִמֶּ֔נּוּ וְנִפְקְח֖וּ עֵֽינֵיכֶ֑ם וִהְיִיתֶם֙ כֵּֽאלֹהִ֔ים יֹדְעֵ֖י טֹ֥וב וָרָֽע׃ | אֲכָלְכֶ֣ם מִמֶּ֔נּוּ | נִפְקְח֖וּ | וִהְיִיתֶם֙ כֵּֽאלֹהִ֔ים |
4 | Genesis 3:12 | הָֽאִשָּׁה֙ אֲשֶׁ֣ר נָתַ֣תָּה עִמָּדִ֔י הִ֛וא נָֽתְנָה־לִּ֥י מִן־הָעֵ֖ץ וָאֹכֵֽל׃ | הָֽאִשָּׁה֙ | עִמָּדִ֔י | וָאֹכֵֽל׃ |
5 | Genesis 14:17 | וַיֵּצֵ֣א מֶֽלֶךְ־סְדֹם֮ לִקְרָאתֹו֒ אַחֲרֵ֣י שׁוּבֹ֗ו מֵֽהַכֹּות֙ אֶת־כְּדָר־לָעֹ֔מֶר וְאֶת־הַמְּלָכִ֖ים אֲשֶׁ֣ר אִתֹּ֑ו אֶל־עֵ֣מֶק שָׁוֵ֔ה | אַחֲרֵ֣י שׁוּבֹ֗ו | אֶת־כְּדָר־לָעֹ֔מֶר וְאֶת־הַמְּלָכִ֖ים | אֲשֶׁ֣ר אִתֹּ֑ו |
result 1
=:
same start slots¶This relation holds when the left and right hand sides are nodes that have the same first slot. It serves to enforce the the children of a parent are textually the first things inside that parent. We have seen it in action before.
:=
same end slots¶This relation holds when the left and right hand sides are nodes that have the same last slot It serves to enforce the the children of a parent are textually the last things inside that parent. We have seen it in action before.
::
same boundary slots¶This relation holds when =:
and :=
both hold between the left and right hand sides.
It serves to look for parents with single children, or at least, where the parent is textually spanned by a single child.
Let us look for a phrase, whose start and end slots coincide with its containing clause. But only if the phrase does not coincide with its parent clause.
query = """
c:clause
:: p:phrase
c ## p
"""
results = A.search(query)
A.table(results, start=1, end=5, baseTypes="phrase")
A.show(results, start=1, end=5, condenseType="clause", baseTypes="phrase")
0.15s 52 results
n | p | clause | phrase |
---|---|---|---|
1 | Genesis 10:21 | גַּם־ה֑וּא אֲבִי֙ כָּל־בְּנֵי־עֵ֔בֶר אֲחִ֖י יֶ֥פֶת הַגָּדֹֽול׃ | גַּם־ה֑וּא אֲחִ֖י יֶ֥פֶת הַגָּדֹֽול׃ |
2 | Genesis 24:24 | בַּת־בְּתוּאֵ֖ל אָנֹ֑כִי בֶּן־מִלְכָּ֕ה | בַּת־בְּתוּאֵ֖ל בֶּן־מִלְכָּ֕ה |
3 | Genesis 31:53 | אֱלֹהֵ֨י אַבְרָהָ֜ם וֵֽאלֹהֵ֤י נָחֹור֙ יִשְׁפְּט֣וּ בֵינֵ֔ינוּ אֱלֹהֵ֖י אֲבִיהֶ֑ם | אֱלֹהֵ֨י אַבְרָהָ֜ם וֵֽאלֹהֵ֤י נָחֹור֙ אֱלֹהֵ֖י אֲבִיהֶ֑ם |
4 | Exodus 28:1 | לְכַהֲנֹו־לִ֑י אַהֲרֹ֕ן נָדָ֧ב וַאֲבִיה֛וּא אֶלְעָזָ֥ר וְאִיתָמָ֖ר בְּנֵ֥י אַהֲרֹֽן׃ | לְכַהֲנֹו־אַהֲרֹ֕ן נָדָ֧ב וַאֲבִיה֛וּא אֶלְעָזָ֥ר וְאִיתָמָ֖ר בְּנֵ֥י אַהֲרֹֽן׃ |
5 | Exodus 28:14 | מִגְבָּלֹ֛ת תַּעֲשֶׂ֥ה אֹתָ֖ם מַעֲשֵׂ֣ה עֲבֹ֑ת | מִגְבָּלֹ֛ת מַעֲשֵׂ֣ה עֲבֹ֑ת |
result 1
result 2
result 3
result 4
result 5
Here you see an extra phrase in such clauses, lying embedded in the clause-spanning phrase.
A nice case of Mind the gap!.
In the common domain:
query = """
c:common otype=clause
:: p:common otype=phrase
c ## p
"""
resultsCustom = A.search(query, sets=customSets)
A.table(resultsCustom, start=1, end=10, baseTypes="phrase")
A.show(resultsCustom, start=1, end=5, condenseType="clause", baseTypes="phrase")
0.59s 1 result
n | p | clause | phrase |
---|---|---|---|
1 | Leviticus 11:9 | אֶת־זֶה֙ תֹּֽאכְל֔וּ מִכֹּ֖ל | אֶת־זֶה֙ מִכֹּ֖ל |
result 1
<:
adjacent before¶This relation holds when the left hand sides ends in a slot that lies before the first slot of the right hand side. It serves to enforce an ordering between siblings of a parent.
:>
adjacent after¶This relation holds when the left hand sides starts in a slot that lies after the last slot of the right hand side.
query = """
clause
phrase
<: phrase
"""
results = A.search(query)
A.table(results, start=1, end=3, baseTypes="phrase")
0.64s 162653 results
n | p | clause | phrase | phrase |
---|---|---|---|---|
1 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | בְּרֵאשִׁ֖ית | בָּרָ֣א |
2 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | בָּרָ֣א | אֱלֹהִ֑ים |
3 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | אֱלֹהִ֑ים | אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ |
query = """
clause
phrase
:> phrase
"""
results = A.search(query)
A.table(results, start=1, end=3, baseTypes="phrase")
0.64s 162653 results
n | p | clause | phrase | phrase |
---|---|---|---|---|
1 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | בָּרָ֣א | בְּרֵאשִׁ֖ית |
2 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | אֱלֹהִ֑ים | בָּרָ֣א |
3 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | אֱלֹהִ֑ים |
Playing with common and rare:
query = """
clause
common otype=phrase
<: rare otype=phrase
"""
resultsCommon = A.search(query, sets=customSets)
A.table(resultsCommon, start=1, end=3, baseTypes="phrase")
0.65s 25956 results
n | p | clause | phrase | phrase |
---|---|---|---|---|
1 | Genesis 1:2 | וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֨הוּ֙ וָבֹ֔הוּ | הָיְתָ֥ה | תֹ֨הוּ֙ וָבֹ֔הוּ |
2 | Genesis 1:4 | כִּי־טֹ֑וב | כִּי־ | טֹ֑וב |
3 | Genesis 1:4 | וַיַּבְדֵּ֣ל אֱלֹהִ֔ים בֵּ֥ין הָאֹ֖ור וּבֵ֥ין הַחֹֽשֶׁךְ׃ | וַ | יַּבְדֵּ֣ל |
query = """
clause
common otype=phrase
:> rare otype=phrase
"""
resultsCommon = A.search(query, sets=customSets)
A.table(resultsCommon, start=1, end=3, baseTypes="phrase")
0.63s 9684 results
n | p | clause | phrase | phrase |
---|---|---|---|---|
1 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | אֱלֹהִ֑ים | בָּרָ֣א |
2 | Genesis 1:2 | וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם׃ | עַל־פְּנֵ֥י הַמָּֽיִם׃ | מְרַחֶ֖פֶת |
3 | Genesis 1:4 | וַיַּבְדֵּ֣ל אֱלֹהִ֔ים בֵּ֥ין הָאֹ֖ור וּבֵ֥ין הַחֹֽשֶׁךְ׃ | אֱלֹהִ֔ים | יַּבְדֵּ֣ל |
Another example: are there clauses with multiple clause atoms without a gap between the two?
query = """
clause
clause_atom
<: clause_atom
"""
results = A.search(query)
A.table(results, start=1, end=10, baseTypes="clause_atom")
0.16s 0 results
Conclusion: there is always textual material between clause atoms of the same clause.
If we lift the adjacency to sequentially before (<<
) we do get results:
query = """
clause
clause_atom
<< clause_atom
"""
results = A.search(query)
A.table(results, start=1, end=5, baseTypes="clause_atom")
A.show(results, start=1, end=1, baseTypes="clause_atom")
0.18s 2707 results
n | p | clause | clause_atom | clause_atom |
---|---|---|---|---|
1 | Genesis 1:7 | וַיַּבְדֵּ֗ל בֵּ֤ין הַמַּ֨יִם֙ וּבֵ֣ין הַמַּ֔יִם | וַיַּבְדֵּ֗ל בֵּ֤ין הַמַּ֨יִם֙ | וּבֵ֣ין הַמַּ֔יִם |
2 | Genesis 1:11 | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב עֵ֣ץ פְּרִ֞י | תַּֽדְשֵׁ֤א הָאָ֨רֶץ֙ דֶּ֔שֶׁא עֵ֚שֶׂב | עֵ֣ץ פְּרִ֞י |
3 | Genesis 1:11 | עֹ֤שֶׂה פְּרִי֙ לְמִינֹ֔ו עַל־הָאָ֑רֶץ | עֹ֤שֶׂה פְּרִי֙ לְמִינֹ֔ו | עַל־הָאָ֑רֶץ |
4 | Genesis 1:12 | וַתֹּוצֵ֨א הָאָ֜רֶץ דֶּ֠שֶׁא עֵ֣שֶׂב וְעֵ֧ץ | וַתֹּוצֵ֨א הָאָ֜רֶץ דֶּ֠שֶׁא עֵ֣שֶׂב | וְעֵ֧ץ |
5 | Genesis 1:12 | עֹ֥שֶׂה פְּרִ֛י לְמִינֵ֑הוּ | עֹ֥שֶׂה פְּרִ֛י | לְמִינֵ֑הוּ |
result 1
The relations with :
in their name always have a requirement somewhere that a slot of the
left hand node equals a slot of the right hand node, or that the two are adjacent.
All these relationships can be relaxed by a nearness number.
If you put a number k
inside the relationship symbols, those restrictions will be relaxed to
the one slot and the other slot should have a mutual distance of at most k
.
=k:
same start within k
slots¶Here is an example.
First we look for clauses, with a phrase in it that starts at the same slot as the clause.
results = A.search(
"""
chapter book=Genesis chapter=1
clause
=: phrase
"""
)
0.16s 126 results
Now we add a bit of freedom, but not much: 0. Indeed, this is no extra freedom, and it should give the same number of results.
results = A.search(
"""
chapter book=Genesis chapter=1
clause
=0: phrase
"""
)
0.20s 126 results
Now we add real freedom: 1 and 2
results = A.search(
"""
chapter book=Genesis chapter=1
clause
=1: phrase
"""
)
0.13s 236 results
results = A.search(
"""
chapter book=Genesis chapter=1
clause
=2: phrase
"""
)
0.12s 315 results
Let us see some cases:
A.table(results, start=1, end=10, baseTypes="phrase", skipCols="1")
A.show(
results,
condensed=False,
start=1,
end=4,
colorMap={2: "yellow", 3: "cyan"},
baseTypes="phrase",
skipCols="1",
)
n | p | clause | phrase |
---|---|---|---|
1 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | בְּרֵאשִׁ֖ית |
2 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | בָּרָ֣א |
3 | Genesis 1:2 | וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֨הוּ֙ וָבֹ֔הוּ | וְ |
4 | Genesis 1:2 | וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֨הוּ֙ וָבֹ֔הוּ | הָאָ֗רֶץ |
5 | Genesis 1:2 | וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְהֹ֑ום | וְ |
6 | Genesis 1:2 | וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְהֹ֑ום | חֹ֖שֶׁךְ |
7 | Genesis 1:2 | וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְהֹ֑ום | עַל־פְּנֵ֣י תְהֹ֑ום |
8 | Genesis 1:2 | וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם׃ | וְ |
9 | Genesis 1:2 | וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם׃ | ר֣וּחַ אֱלֹהִ֔ים |
10 | Genesis 1:3 | וַיֹּ֥אמֶר אֱלֹהִ֖ים | וַ |
result 1
result 2
result 3
result 4
The first and second result show the same clause, with its first and second phrase respectively.
Note that we look for phrases that lie embedded in their clause. So we do not get phrases of a preceding clause.
But if we want, we can get those as well.
results = A.search(
"""
chapter book=Genesis chapter=1
c:clause
p:phrase
c =2: p
"""
)
0.03s 485 results
We have more results now. Here is a closer look:
A.table(results, start=1, end=5, baseTypes="phrase", skipCols="1")
A.show(
results,
condensed=False,
start=12,
end=14,
colorMap={2: "yellow", 3: "cyan"},
baseTypes="phrase",
skipCols="1",
)
n | p | clause | phrase |
---|---|---|---|
1 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | בְּרֵאשִׁ֖ית |
2 | Genesis 1:1 | בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ | בָּרָ֣א |
3 | Genesis 1:2 | וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֨הוּ֙ וָבֹ֔הוּ | וְ |
4 | Genesis 1:2 | וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֨הוּ֙ וָבֹ֔הוּ | הָאָ֗רֶץ |
5 | Genesis 1:2 | וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְהֹ֑ום | וְ |
result 12
result 13
result 14
Here you see in results 13 and 14 a phrase of the previous clause.
Lets also play with common and rare:
resultsCommon = A.search(
"""
verse
clause
=: rare otype=phrase
""",
sets=customSets,
)
0.30s 10313 results
resultsCommon = A.search(
"""
verse
clause
=0: rare otype=phrase
""",
sets=customSets,
)
0.35s 10313 results
resultsCommon = A.search(
"""
verse
clause
=1: rare otype=phrase
""",
sets=customSets,
)
0.46s 26113 results
resultsCommon = A.search(
"""
verse
clause
=2: rare otype=phrase
""",
sets=customSets,
)
0.54s 39382 results
You are comfortable in space now.
Ready to enter a whole new dimension?
quantifiers from MQL rough gaps
CC-BY Dirk Roorda