How to use get_base_keywords method in avocado

Best Python code snippet using avocado_python

loader.py

Source:loader.py Github

copy

Full Screen

...154 self._decorator_mapping.update(plugin.get_full_decorator_mapping())155 def get_extra_listing(self):156 for loader_plugin in self._initialized_plugins:157 loader_plugin.get_extra_listing()158 def get_base_keywords(self):159 base_path = []160 for loader_plugin in self._initialized_plugins:161 base_path += loader_plugin.get_base_keywords()162 return base_path163 def get_type_label_mapping(self):164 if self._label_mapping is None:165 raise RuntimeError(166 "LoaderProxy.discover has to be called before "167 "LoaderProxy.get_type_label_mapping"168 )169 return self._label_mapping170 def get_decorator_mapping(self):171 if self._label_mapping is None:172 raise RuntimeError(173 "LoaderProxy.discover has to be called before "174 "LoaderProxy.get_decorator_mapping"175 )...

Full Screen

Full Screen

skosmos.py

Source:skosmos.py Github

copy

Full Screen

...69 data, key=lambda x: x.get('label', {}).get(language, x.get('label', {}).get('en', 'zzz')).lower()70 )71 cache.set(cache_key, data, CACHE_TIME)72 return data73def get_base_keywords():74 return fetch_data('http://base.uni-ak.ac.at/recherche/keywords/collection_base', source_name='base')75def get_disciplines():76 cache_key = 'get_disciplines'77 data = cache.get(cache_key, [])78 if not data:79 data = list(80 filter(81 lambda x: len(x['source'].split('/')[-1]) % 3 == 0,82 fetch_data(83 'http://base.uni-ak.ac.at/portfolio/disciplines/oefos', fetch_children=True, source_name='voc'84 ),85 )86 )87 if data:88 cache.set(cache_key, data, CACHE_TIME)89 return data90def get_formats():91 return fetch_data('http://base.uni-ak.ac.at/portfolio/vocabulary/format_type')92def get_keywords():93 return [94 *get_base_keywords(),95 *get_disciplines(),96 ]97def get_languages():98 return fetch_data('http://base.uni-ak.ac.at/portfolio/languages/iso_639_1')99def get_languages_choices():100 language = get_language() or 'en'101 cache_key_languages = f'get_languages_{language}'102 cache_key_languages_labels = f'get_languages_labels_{language}'103 languages = cache.get(cache_key_languages, [])104 languages_labels = cache.get(cache_key_languages_labels, [])105 if not languages or not languages_labels:106 r = skosmos.top_concepts(settings.LANGUAGES_VOCID, lang=language)107 r = sorted(r, key=lambda k: k['label'].lower())108 for lang in r:...

Full Screen

Full Screen

get_keywords.py

Source:get_keywords.py Github

copy

Full Screen

...27kb_diversity = 0.328kw_model = KeyBERT()29nltk.download('wordnet')30nltk.download('omw-1.4')31def get_base_keywords(bill: Bill):32 if bill.bill_type not in prefixes.keys():33 return []34 prefix_list = prefixes[bill.bill_type]35 number = bill.number.split(".")[-1]36 return [bill.bill_id, bill.number] + list(map(lambda x: x + number, prefix_list))37def kw_cleanup(text):38 # Remove Punctuation (Unneeded)39 # text = remove_punc(text)40 # Tokenize41 tokens = text.split(" ")42 # Remove Stopwords43 tokens = [tok for tok in tokens if tok not in stop_words]44 # Stem45 ls = WordNetLemmatizer()46 tokens = [ls.lemmatize(tok) for tok in tokens]47 # Remove bad words48 tokens = [tok for tok in tokens if tok not in nono_words]49 return ' '.join(tokens)50def keybert_extraction(summary: str):51 summary_keywords = kw_model.extract_keywords(52 docs=summary, 53 keyphrase_ngram_range=n_gram_range, 54 stop_words=stop_words, 55 top_n=top_n,56 use_mmr=use_mmr,57 diversity=kb_diversity)58 # For keyBERT, we do 1 - x[1] in the sort method since highest confidence value is best59 keywords = summary_keywords60 keywords.sort(key = lambda x: 1 - x[1])61 62 return keywords63def derive_keywords(summary: str):64 summary = summary.lower()65 summary = kw_cleanup(summary)66 keybert_keywords = keybert_extraction(summary)67 68 return list(set(keybert_keywords))69def get_keywords(bill: Bill):70 # get list of obvious keywords71 known_keywords = get_base_keywords(bill)72 # use NLP to generate other keywords73 if (bill.summary is None or len(bill.summary) > 100000) and bill.summary_short is not None:74 generated_keywords = derive_keywords(bill.summary_short.replace('\n', ''))75 elif bill.summary_short is not None and len(bill.summary) < 100000:76 generated_keywords = derive_keywords(bill.summary.replace('\n', ''))77 else:78 generated_keywords = []...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful