Run this model with HF Jobs
Run boeing/aviation-ner on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/boeing/aviation-ner. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/boeing/aviation-ner on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use boeing/aviation-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Aviation NER
How to use boeing/aviation-ner with Aviation NER:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Upload ner_tokenization.txt
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293import re
"""Basic Tokenization to separate non-word characters from tokens"""
class NerTokenization:
def __init__(self):
self.tok_final = {".", ",", "-", "/", "\\", ";", ":", '"', "'", ")", "]"}
self.tok_initial = {'"', "'", "(","["}
self.internal_split = {"/", ";", ":", "\\"}
self.split_regex = '|'.join(map(re.escape, self.internal_split)) # characters concatenated on logical or ("|")
def right_strip(self, tok):
retokenized = []
if all(c in self.tok_final for c in tok):
retokenized.append(tok)
else:
while True:
if tok[-1] in self.tok_final:
tok, punc = tok[:-1], tok[-1]
retokenized.insert(0, punc)
else:
retokenized.insert(0, tok)
break
return retokenized
def left_strip(self, token_list):
retokenized = []
for tok in token_list:
if all(c in self.tok_final for c in tok):
retokenized.append(tok)
else:
while True:
try:
if tok[0] in self.tok_initial:
punc, tok = tok[0], tok[1:]
retokenized.append(punc)
else:
retokenized.append(tok)
break
except:
break
return retokenized
def tok_split(self, tok):
if any(c in self.internal_split for c in tok[:-1]):
result = re.split(f'({self.split_regex})', tok)
tok_split = [s for s in result if s]
else:
tok_split = [tok]
return tok_split
def tokenize_string(self, string_to_tokenize):
tokenized_string = []
toks = string_to_tokenize.split()
for this_tok in toks:
split_toks = self.tok_split(this_tok) # check if splits
for tok in split_toks:
r_stripped_toks = self.right_strip(tok)
l_stripped_toks = self.left_strip(r_stripped_toks)
tokenized_string.extend(l_stripped_toks)
return " ".join(tokenized_string)
@staticmethod
def convert_to_training_format(conll_file_path):
pass
if __name__ == "__main__":
s = 'The "dog." is (here): to stay, I think. 47-52'
tokenizer = NerTokenization()
s2 = tokenizer.tokenize_string(s)
print(s2)ner_tokenization.txtAdded+93