def loadTf(): TF = Fabric(locations=[f'{TF_PATH}/{VERSION}']) allFeatures = TF.explore(silent=True, show=True) loadableFeatures = allFeatures['nodes'] + allFeatures['edges'] api = TF.load(loadableFeatures) if api: print(f'max node = {api.F.otype.maxNode}') print(api.F.root.freqList()[0:20])
def loadTf(): TF = Fabric(locations=[OUT_DIR]) allFeatures = TF.explore(silent=True, show=True) loadableFeatures = allFeatures['nodes'] + allFeatures['edges'] api = TF.load(loadableFeatures, silent=False) if api: print(f'max node = {api.F.otype.maxNode}') print(api.F.root.freqList()[0:20])
def loadTf(outDir): TF = Fabric(locations=[outDir]) allFeatures = TF.explore(silent=True, show=True) loadableFeatures = allFeatures["nodes"] + allFeatures["edges"] api = TF.load(loadableFeatures, silent=False) if api: print(f"max node = {api.F.otype.maxNode}") print("Frequencies of words") for (word, n) in api.F.letters.freqList()[0:20]: print(f"{n:>6} x {word}")
def loadTf(): print(f'Load TF dataset for the first time') TF = Fabric(locations=TF_PATH, modules=['']) api = TF.load('') allFeatures = TF.explore(silent=False, show=True) loadableFeatures = allFeatures['nodes'] + allFeatures['edges'] TF.load(loadableFeatures, add=True) return api print('All done')
import os, sys, collections from tf.fabric import Fabric # locations = '~/github/etcbc' locations = '/home/oem/text-fabric-data/etcbc' coreModule = 'bhsa' sources = [coreModule, 'phono'] # version = '2017' version = 'c' tempDir = os.path.expanduser(f'{locations}/{coreModule}/_temp/{version}/r') tableFile = f'{tempDir}/{coreModule}{version}.txt' modules = [f'{s}/tf/{version}' for s in sources] TF = Fabric(locations=locations, modules=modules) api = TF.load('') api = TF.load( ('suffix_person', 'tab', 'trailer', 'trailer_utf8', 'txt', 'typ', 'uvf', 'vbe', 'vbs', 'verse', 'voc_lex', 'voc_lex_utf8', 'vs', 'vt', 'distributional_parent', 'functional_parent', 'mother', 'oslots')) allFeatures = TF.explore(silent=False, show=True) loadableFeatures = allFeatures['nodes'] + allFeatures['edges'] del (api) api = TF.load(loadableFeatures) api.makeAvailableIn(globals()) print('done')