bfarzin / haha_2019 Goto Github PK
View Code? Open in Web Editor NEWUsing Fastai library to classify Twitter jokes in Spanish
Using Fastai library to classify Twitter jokes in Spanish
Update to return backwards tokens with CustomTokenizer with bwd=True flag. Start with xxbos
and then return the series of tokens in reverse order [::-1]
. Proceed as usual with everything else. Model works "backwards" and should produce slightly different results. Ensemble with forward models and submit scores.
"class Tokenizer():\n",
" \"Put together rules and a tokenizer function to tokenize text with multiprocessing.\"\n",
" def __init__(self, tok_func:Callable=SpacyTokenizer, lang:str='en', pre_rules:ListRules=None,\n",
" post_rules:ListRules=None, special_cases:Collection[str]=None, n_cpus:int=None,bwd_toks=False):\n",
" self.tok_func,self.lang,self.special_cases = tok_func,lang,special_cases\n",
" self.pre_rules = ifnone(pre_rules, defaults.text_pre_rules )\n",
" self.post_rules = ifnone(post_rules, defaults.text_post_rules)\n",
" self.special_cases = special_cases if special_cases else defaults.text_spec_tok\n",
" self.n_cpus = ifnone(n_cpus, defaults.cpus)\n",
" self.bwd_toks = bwd_toks\n",
" \n",
"...\n",
"\n",
" def process_text(self, t:str, tok:BaseTokenizer) -> List[str]:\n",
" \"Process one text `t` with tokenizer `tok`.\"\n",
" for rule in self.pre_rules: t = rule(t)\n",
" toks = tok.tokenizer(t)\n",
" for rule in self.post_rules: toks = rule(toks)\n",
" return listify(toks[0])+toks[1:][::-1] if self.bwd_toks else toks # <-- Just one line changed!"
]
},
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.