"Gutenberg Children Books" corpus, new "LG-E-noQuotes" dataset (GC_LGEnglish_noQuotes_fullyParsed.ull),
trash filter off: min_word_count = 1
, max_sentence_length = 24
, Link Grammar 5.5.1.
This notebook is shared as static WSD_option_tests2019-04-09.html, Output data shared via WSD_option_tests2019-04-09 directory.
import os, sys, time, pandas as pd
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path: sys.path.append(module_path)
from src.grammar_learner.utl import UTC, test_stats
from src.grammar_learner.read_files import check_dir, check_corpus
from src.grammar_learner.write_files import list2file
from src.grammar_learner.widgets import html_table
from src.grammar_learner.pqa_table import table_rows, params, wide_rows
tmpath = module_path + '/tmp/'
check_dir(tmpath, True, 'none')
start = time.time()
runs = (1,1)
print(UTC(), ':: module_path:', module_path)
corpus = 'POC-English-disAmb'
dataset = 'LG-ANY-all-parses-agm-100'
kwargs = {
'max_sentence_length': 24 ,
'max_unparsed_words' : 1 , # dataset: .@e
'left_wall' : '' ,
'period' : False ,
'context' : 2 ,
'min_word_count': 1 ,
'word_space' : 'sparse' ,
'clustering' : ['agglomerative', 'ward'],
'clustering_metric' : ['silhouette', 'cosine'],
'cluster_range' : [20] ,
'top_level' : 0.01 ,
'grammar_rules' : 2 ,
'max_disjuncts' : 1000000 , # off
'stop_words' : [] ,
'tmpath' : tmpath ,
'verbose' : 'log+' ,
'template_path' : 'poc-turtle',
'linkage_limit' : 1000 }
rp = module_path + '/data/' + corpus + '/poc-english_ex-parses-gold.txt'
cp = rp # corpus path = reference_path
runs = (1,1)
out_dir = module_path + '/output/' + 'WSD_option_tests_' + str(UTC())[:10] + '_'
print(UTC(), '\n', out_dir)
kwargs['wsd_symbol'] = ''
¶%%capture
kwargs['wsd_symbol'] = ''
table = []
line = [['no WSD', corpus, dataset, 0, 0, 'none']]
a, _, header, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
header[0] = 'WSD'
table.extend(a)
display(html_table([header] + a))
with open(out_dir + '/POC-English-disAmb_LG-ANY-all-parses-agm-100_dALWEd_no-gen/dict_20C_2019-04-09_0007.4.0.dict') as f:
rules = f.read(); print('No disamiguation: "@" not replaced with ".":\n', rules[115:400])
kwargs['wsd_symbol'] = '@'
¶%%capture
kwargs['wsd_symbol'] = '@'
line = [['"@"', corpus, dataset, 0, 0, 'none']]
a, _, _, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
table.extend(a)
display(html_table([header] + a))
with open(out_dir + '/POC-English-disAmb_LG-ANY-all-parses-agm-100_dALWEd_no-gen/dict_20C_2019-04-09_0007.4.0.dict') as f:
rules = f.read(); print('Disamiguation: "@" replaced with ".":\n', rules[115:400])
kwargs['wsd_symbol'] = '@'
¶%%capture
kwargs['wsd_symbol'] = '@'
kwargs['word_space'] = 'discrete'
kwargs['clustering'] = 'group'
kwargs['cluster_range'] = [0]
line = [['"@"', corpus, dataset, 0, 0, 'none']]
a, _, _, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
table.extend(a)
display(html_table([header] + a))
with open(out_dir + '/POC-English-disAmb_LG-ANY-all-parses-agm-100_dILEd_no-gen/dict_61C_2019-04-09_0007.4.0.dict') as f:
rules = f.read(); print('Disamiguation: "@" replaced with ".":\n', rules[115:334])
kwargs['wsd_symbol'] = ''
¶%%capture
kwargs['wsd_symbol'] = ''
line = [['no WSD', corpus, dataset, 0, 0, 'none']]
a, _, _, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
table.extend(a)
display(html_table([header] + a))
with open(out_dir + '/POC-English-disAmb_LG-ANY-all-parses-agm-100_dILEd_no-gen/dict_61C_2019-04-09_0007.4.0.dict') as f:
rules = f.read(); print('No disamiguation: "@" not replaced with ".":\n', rules[115:334])