%load_ext autoreload
%autoreload 2
import os
from tf.fabric import Fabric
GH_BASE = os.path.expanduser('~/github')
ORG = 'annotation'
REPO = 'banks'
FOLDER = 'tf'
TF_DIR = f'{GH_BASE}/{ORG}/{REPO}/{FOLDER}'
VERSION = '0.2'
TF_PATH = f'{TF_DIR}/{VERSION}'
TF = Fabric(locations=TF_PATH)
This is Text-Fabric 7.6.8 Api reference : https://annotation.github.io/text-fabric/Api/Fabric/ 10 features found and 0 ignored
We ask for a list of all features:
allFeatures = TF.explore(silent=True, show=True)
loadableFeatures = allFeatures['nodes'] + allFeatures['edges']
loadableFeatures
('author', 'gap', 'letters', 'number', 'otype', 'punc', 'terminator', 'title', 'oslots')
We load all features:
api = TF.load(loadableFeatures, silent=False)
T = api.T
F = api.F
0.00s loading features ... | 0.00s B otype from /Users/dirk/github/annotation/banks/tf/0.2 | 0.00s B oslots from /Users/dirk/github/annotation/banks/tf/0.2 | 0.00s B title from /Users/dirk/github/annotation/banks/tf/0.2 | 0.00s B number from /Users/dirk/github/annotation/banks/tf/0.2 | 0.00s B letters from /Users/dirk/github/annotation/banks/tf/0.2 | 0.00s B punc from /Users/dirk/github/annotation/banks/tf/0.2 | 0.00s B terminator from /Users/dirk/github/annotation/banks/tf/0.2 | 0.00s B author from /Users/dirk/github/annotation/banks/tf/0.2 | 0.00s B gap from /Users/dirk/github/annotation/banks/tf/0.2 0.03s All features loaded/computed - for details use loadLog()
T.formats
{'line-default': 'word', 'line-term': 'line', 'text-orig-full': 'word'}
words = F.otype.s('word')
lines = F.otype.s('line')
sents = F.otype.s('sentence')
explain = True
T.text(lines[0], explain=explain)
EXPLANATION: T.text) called with parameters: nodes : single node fmt : implicit descend: implicit func : no custom format implementation NODE: line 103 TARGET LEVEL: line (no expansion needed) (descend=None) (format target type) EXPANSION: 1 line 103 FORMATTING: implicit line-default MATERIAL: line 103 ADDS "XXX, "
'XXX, '
T.text(lines[0], descend=True, explain=explain)
EXPLANATION: T.text) called with parameters: nodes : single node fmt : implicit descend: True NODE: line 103 TARGET LEVEL: word (descend=True) (target of implicit text-orig-full) EXPANSION: words 1, 2, 3 FORMATTING: with node-specific default line-default 1m 43s MATERIAL: word 1 ADDS "Everything " word 2 ADDS "about " word 3 ADDS "us "
'Everything about us '
T.text(lines[0], fmt='line-term', explain=explain)
EXPLANATION: T.text) called with parameters: nodes : single node fmt : line-term targeted at line descend: implicit NODE: line 103 TARGET LEVEL: line (no expansion needed) (descend=None) (target of explicit line-term) EXPANSION: line 103 FORMATTING: with explicit line-term 56s MATERIAL: line 103 ADDS ", "
', '
T.text(lines[0:2], explain=explain)
EXPLANATION: T.text) called with parameters: nodes : iterable of 2 nodes fmt : implicit descend: implicit NODE: line 103 TARGET LEVEL: line (no expansion needed) (descend=None) (node type) EXPANSION: line 103 FORMATTING: with node-specific default line-default MATERIAL: line 103 ADDS "XXX, " NODE: line 104 TARGET LEVEL: line (no expansion needed) (descend=None) (node type) EXPANSION: line 104 FORMATTING: with node-specific default line-default MATERIAL: line 104 ADDS "XXX, "
'XXX, XXX, '
T.text(lines[0:2], descend=True, explain=explain)
EXPLANATION: T.text) called with parameters: nodes : iterable of 2 nodes fmt : implicit descend: True NODE: line 103 TARGET LEVEL: word (descend=True) (target of implicit text-orig-full) EXPANSION: words 1, 2, 3 FORMATTING: with node-specific default line-default MATERIAL: word 1 ADDS "Everything " word 2 ADDS "about " word 3 ADDS "us " NODE: line 104 TARGET LEVEL: word (descend=True) (target of implicit text-orig-full) EXPANSION: words 4, 5, 6 FORMATTING: with node-specific default line-default MATERIAL: word 4 ADDS "everything " word 5 ADDS "around " word 6 ADDS "us "
'Everything about us everything around us '
T.text(lines[0:2], fmt='line-term', explain=explain)
EXPLANATION: T.text) called with parameters: nodes : iterable of 2 nodes fmt : line-term targeted at line descend: implicit NODE: line 103 TARGET LEVEL: line (no expansion needed) (descend=None) (target of explicit line-term) EXPANSION: line 103 FORMATTING: with explicit line-term MATERIAL: line 103 ADDS ", " NODE: line 104 TARGET LEVEL: line (no expansion needed) (descend=None) (target of explicit line-term) EXPANSION: line 104 FORMATTING: with explicit line-term MATERIAL: line 104 ADDS ", "
', , '
T.text(sents[0], explain=explain)
EXPLANATION: T.text) called with parameters: nodes : single node fmt : implicit descend: implicit NODE: sentence 115 TARGET LEVEL: word (descend=None) (target of implicit text-orig-full) EXPANSION: words 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 FORMATTING: with overall default text-orig-full MATERIAL: word 1 ADDS "Everything " word 2 ADDS "about " word 3 ADDS "us, " word 4 ADDS "everything " word 5 ADDS "around " word 6 ADDS "us, " word 7 ADDS "everything " word 8 ADDS "we " word 9 ADDS "know " word 10 ADDS "and " word 11 ADDS "can " word 12 ADDS "know " word 13 ADDS "of " word 14 ADDS "is " word 15 ADDS "composed " word 16 ADDS "ultimately " word 17 ADDS "of " word 18 ADDS "patterns " word 19 ADDS "of " word 20 ADDS "nothing; " word 21 ADDS "that’s " word 22 ADDS "the " word 23 ADDS "bottom " word 24 ADDS "line, " word 25 ADDS "the " word 26 ADDS "final " word 27 ADDS "truth. "
'Everything about us, everything around us, everything we know and can know of is composed ultimately of patterns of nothing; that’s the bottom line, the final truth. '
T.text(sents[0], descend=False, explain=explain)
EXPLANATION: T.text) called with parameters: nodes : single node fmt : implicit descend: False NODE: sentence 115 TARGET LEVEL: sentence (descend=False) (no expansion) EXPANSION: sentence 115 FORMATTING: with overall default text-orig-full MATERIAL: sentence 115 ADDS " "
' '
T.text(sents[0], fmt='line-term', explain=explain)
EXPLANATION: T.text) called with parameters: nodes : single node fmt : line-term targeted at line descend: implicit NODE: sentence 115 TARGET LEVEL: line (descend=None) (target of explicit line-term) EXPANSION: lines 103, 104, 105, 106 FORMATTING: with explicit line-term MATERIAL: line 103 ADDS ", " line 104 ADDS ", " line 105 ADDS "; " line 106 ADDS ". "
', , ; . '
T.text(sents[0:2], explain=explain)
EXPLANATION: T.text) called with parameters: nodes : iterable of 2 nodes fmt : implicit descend: implicit NODE: sentence 115 TARGET LEVEL: word (descend=None) (target of implicit text-orig-full) EXPANSION: words 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 FORMATTING: with overall default text-orig-full MATERIAL: word 1 ADDS "Everything " word 2 ADDS "about " word 3 ADDS "us, " word 4 ADDS "everything " word 5 ADDS "around " word 6 ADDS "us, " word 7 ADDS "everything " word 8 ADDS "we " word 9 ADDS "know " word 10 ADDS "and " word 11 ADDS "can " word 12 ADDS "know " word 13 ADDS "of " word 14 ADDS "is " word 15 ADDS "composed " word 16 ADDS "ultimately " word 17 ADDS "of " word 18 ADDS "patterns " word 19 ADDS "of " word 20 ADDS "nothing; " word 21 ADDS "that’s " word 22 ADDS "the " word 23 ADDS "bottom " word 24 ADDS "line, " word 25 ADDS "the " word 26 ADDS "final " word 27 ADDS "truth. " NODE: sentence 116 TARGET LEVEL: word (descend=None) (target of implicit text-orig-full) EXPANSION: words 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55 FORMATTING: with overall default text-orig-full MATERIAL: word 28 ADDS "So " word 29 ADDS "where " word 30 ADDS "we " word 31 ADDS "find " word 32 ADDS "we " word 33 ADDS "have " word 34 ADDS "any " word 35 ADDS "control " word 36 ADDS "over " word 37 ADDS "those " word 38 ADDS "patterns, " word 39 ADDS "why " word 40 ADDS "not " word 41 ADDS "make " word 42 ADDS "the " word 43 ADDS "most " word 44 ADDS "elegant " word 45 ADDS "ones, " word 46 ADDS "the " word 47 ADDS "most " word 48 ADDS "enjoyable " word 49 ADDS "and " word 50 ADDS "good " word 51 ADDS "ones, " word 52 ADDS "in " word 53 ADDS "our " word 54 ADDS "own " word 55 ADDS "terms? "
'Everything about us, everything around us, everything we know and can know of is composed ultimately of patterns of nothing; that’s the bottom line, the final truth. So where we find we have any control over those patterns, why not make the most elegant ones, the most enjoyable and good ones, in our own terms? '
T.text(sents[0:2], descend=False, explain=explain)
EXPLANATION: T.text) called with parameters: nodes : iterable of 2 nodes fmt : implicit descend: False NODE: sentence 115 TARGET LEVEL: sentence (descend=False) (no expansion) EXPANSION: sentence 115 FORMATTING: with overall default text-orig-full MATERIAL: sentence 115 ADDS " " NODE: sentence 116 TARGET LEVEL: sentence (descend=False) (no expansion) EXPANSION: sentence 116 FORMATTING: with overall default text-orig-full MATERIAL: sentence 116 ADDS " "
' '
T.text(sents[0:2], fmt='line-term', explain=explain)
EXPLANATION: T.text) called with parameters: nodes : iterable of 2 nodes fmt : line-term targeted at line descend: implicit NODE: sentence 115 TARGET LEVEL: line (descend=None) (target of explicit line-term) EXPANSION: lines 103, 104, 105, 106 FORMATTING: with explicit line-term MATERIAL: line 103 ADDS ", " line 104 ADDS ", " line 105 ADDS "; " line 106 ADDS ". " NODE: sentence 116 TARGET LEVEL: line (descend=None) (target of explicit line-term) EXPANSION: lines 107, 108, 109 FORMATTING: with explicit line-term MATERIAL: line 107 ADDS ", " line 108 ADDS ", " line 109 ADDS "? "
', , ; . , , ? '
content = list(words[50:53]) + list(lines[4:6]) + list(sents[0:2])
T.text(content, explain=explain)
EXPLANATION: T.text) called with parameters: nodes : iterable of 7 nodes fmt : implicit descend: implicit NODE: word 51 TARGET LEVEL: word (no expansion needed) (descend=None) (target of implicit text-orig-full) EXPANSION: word 51 FORMATTING: with overall default text-orig-full MATERIAL: word 51 ADDS "ones, " NODE: word 52 TARGET LEVEL: word (no expansion needed) (descend=None) (target of implicit text-orig-full) EXPANSION: word 52 FORMATTING: with overall default text-orig-full MATERIAL: word 52 ADDS "in " NODE: word 53 TARGET LEVEL: word (no expansion needed) (descend=None) (target of implicit text-orig-full) EXPANSION: word 53 FORMATTING: with overall default text-orig-full MATERIAL: word 53 ADDS "our " NODE: line 107 TARGET LEVEL: line (no expansion needed) (descend=None) (node type) EXPANSION: line 107 FORMATTING: with node-specific default line-default MATERIAL: line 107 ADDS "XXX, " NODE: line 108 TARGET LEVEL: line (no expansion needed) (descend=None) (node type) EXPANSION: line 108 FORMATTING: with node-specific default line-default MATERIAL: line 108 ADDS "XXX, " NODE: sentence 115 TARGET LEVEL: word (descend=None) (target of implicit text-orig-full) EXPANSION: words 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 FORMATTING: with overall default text-orig-full MATERIAL: word 1 ADDS "Everything " word 2 ADDS "about " word 3 ADDS "us, " word 4 ADDS "everything " word 5 ADDS "around " word 6 ADDS "us, " word 7 ADDS "everything " word 8 ADDS "we " word 9 ADDS "know " word 10 ADDS "and " word 11 ADDS "can " word 12 ADDS "know " word 13 ADDS "of " word 14 ADDS "is " word 15 ADDS "composed " word 16 ADDS "ultimately " word 17 ADDS "of " word 18 ADDS "patterns " word 19 ADDS "of " word 20 ADDS "nothing; " word 21 ADDS "that’s " word 22 ADDS "the " word 23 ADDS "bottom " word 24 ADDS "line, " word 25 ADDS "the " word 26 ADDS "final " word 27 ADDS "truth. " NODE: sentence 116 TARGET LEVEL: word (descend=None) (target of implicit text-orig-full) EXPANSION: words 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55 FORMATTING: with overall default text-orig-full MATERIAL: word 28 ADDS "So " word 29 ADDS "where " word 30 ADDS "we " word 31 ADDS "find " word 32 ADDS "we " word 33 ADDS "have " word 34 ADDS "any " word 35 ADDS "control " word 36 ADDS "over " word 37 ADDS "those " word 38 ADDS "patterns, " word 39 ADDS "why " word 40 ADDS "not " word 41 ADDS "make " word 42 ADDS "the " word 43 ADDS "most " word 44 ADDS "elegant " word 45 ADDS "ones, " word 46 ADDS "the " word 47 ADDS "most " word 48 ADDS "enjoyable " word 49 ADDS "and " word 50 ADDS "good " word 51 ADDS "ones, " word 52 ADDS "in " word 53 ADDS "our " word 54 ADDS "own " word 55 ADDS "terms? "
'ones, in our XXX, XXX, Everything about us, everything around us, everything we know and can know of is composed ultimately of patterns of nothing; that’s the bottom line, the final truth. So where we find we have any control over those patterns, why not make the most elegant ones, the most enjoyable and good ones, in our own terms? '
T.text(content, descend=False, explain=explain)
EXPLANATION: T.text) called with parameters: nodes : iterable of 7 nodes fmt : implicit descend: False NODE: word 51 TARGET LEVEL: word (descend=False) (no expansion) EXPANSION: word 51 FORMATTING: with overall default text-orig-full MATERIAL: word 51 ADDS "ones, " NODE: word 52 TARGET LEVEL: word (descend=False) (no expansion) EXPANSION: word 52 FORMATTING: with overall default text-orig-full MATERIAL: word 52 ADDS "in " NODE: word 53 TARGET LEVEL: word (descend=False) (no expansion) EXPANSION: word 53 FORMATTING: with overall default text-orig-full MATERIAL: word 53 ADDS "our " NODE: line 107 TARGET LEVEL: line (descend=False) (no expansion) EXPANSION: line 107 FORMATTING: with node-specific default line-default MATERIAL: line 107 ADDS "XXX, " NODE: line 108 TARGET LEVEL: line (descend=False) (no expansion) EXPANSION: line 108 FORMATTING: with node-specific default line-default MATERIAL: line 108 ADDS "XXX, " NODE: sentence 115 TARGET LEVEL: sentence (descend=False) (no expansion) EXPANSION: sentence 115 FORMATTING: with overall default text-orig-full MATERIAL: sentence 115 ADDS " " NODE: sentence 116 TARGET LEVEL: sentence (descend=False) (no expansion) EXPANSION: sentence 116 FORMATTING: with overall default text-orig-full MATERIAL: sentence 116 ADDS " "
'ones, in our XXX, XXX, '
T.text(content, fmt='line-term', explain=explain)
EXPLANATION: T.text) called with parameters: nodes : iterable of 7 nodes fmt : line-term targeted at line descend: implicit NODE: word 51 TARGET LEVEL: line (descend=None) (target of explicit line-term) EXPANSION: lines FORMATTING: with explicit line-term MATERIAL: NODE: word 52 TARGET LEVEL: line (descend=None) (target of explicit line-term) EXPANSION: lines FORMATTING: with explicit line-term MATERIAL: NODE: word 53 TARGET LEVEL: line (descend=None) (target of explicit line-term) EXPANSION: lines FORMATTING: with explicit line-term MATERIAL: NODE: line 107 TARGET LEVEL: line (no expansion needed) (descend=None) (target of explicit line-term) EXPANSION: line 107 FORMATTING: with explicit line-term MATERIAL: line 107 ADDS ", " NODE: line 108 TARGET LEVEL: line (no expansion needed) (descend=None) (target of explicit line-term) EXPANSION: line 108 FORMATTING: with explicit line-term MATERIAL: line 108 ADDS ", " NODE: sentence 115 TARGET LEVEL: line (descend=None) (target of explicit line-term) EXPANSION: lines 103, 104, 105, 106 FORMATTING: with explicit line-term MATERIAL: line 103 ADDS ", " line 104 ADDS ", " line 105 ADDS "; " line 106 ADDS ". " NODE: sentence 116 TARGET LEVEL: line (descend=None) (target of explicit line-term) EXPANSION: lines 107, 108, 109 FORMATTING: with explicit line-term MATERIAL: line 107 ADDS ", " line 108 ADDS ", " line 109 ADDS "? "
', , , , ; . , , ? '
def test():
var = locals()
def verbose(x):
exec(x, var)
verbose('x = "aap"')
verbose('print(x)')
verbose('print("noot")')
return 'OK'
test()
aap noot
'OK'