Views
No views yet
trust_remote_code=True.1from transformers import AutoModel
2humit_tagger = AutoModel.from_pretrained("Humit-Oslo/humit-tagger-base", trust_remote_code=True)humit_tagger = AutoModel.from_pretrained("Humit-Oslo/humit-tagger-base", trust_remote_code=True, batch_size=16, device="cuda")| parameter | .tag supports | .identify_language supports | options | default | used |
|---|---|---|---|---|---|
| inp | yes | yes | None | to give the input. No need to give parameter name if the parameter is the first parameter | |
| lang | yes | no | "nn", "bm", "au" | "au" | to specify the language of tags. "au" tries to identify the language automatically from the input. |
| input_directory | yes | yes | None | to apply the function recursively on input_directory | |
| output_directory | yes | yes | None | to output recursively in output_directory. The written files will have extension ".tagged" or ".lang" according to the function called. | |
| one_sentence_per_line | yes | yes | True / False | False | not to apply sentence boundary detection and consider each line as a sentence in the input or the input file(s). |
| lang_per_sentence | yes | no | True / False | False | identify the language per sentence and output the tags according to the language identified for that sentence. If this is not set, and lang is "au" then the whole input (or a file if input_directory is used) is used to identify the language. |
| write_output_to | yes | yes | a file path, a file handle, or "list" | sys.stdout | to specify where to write the output. If a file path is provided, the output will be written to that file. The file is overwritten. If a file handle is provided, then the output is written there. If "list" is given as parameters, then the function returns a python "list". |
| output_tsv | yes | yes | True/False | False | to specify the output format. The default is the json format. If multiple sentences exist, each line is a single valid json but not the whole output. This option cannot be used along with write_output_to="list" |
| lemmatisation | yes | no | True / False | True | to specify whether lemmatisation will be applied. Disabling lemmatisation by giving this parameter as False makes the tagger faster. |
| lang_per_item | no | yes | True/False | False | consider each item in the list given as separate input for language identification. |
| fast_mode | no | yes | True/False | False | identify languages of the files in the input directory in fast mode. This mode uses only the beginning of the files in identification. This method is much more faster for many files but is not as accurate as if this paramer is set to False. |
humit_tagger.tag("Dette er en norsk setning.") 1humit_tagger.tag(["Dette er en norsk setning.", "Dette er en annen norsk setning."])
21with open ("path/to/file", "r") as f:
2 humit_tagger.tag(f.read()) humit_tagger.tag(input_directory = "path/to/input/directory", output_directory = "path/to/output/directory" )humit_tagger.identify_language("Eg elskar snø.")humit_tagger.identify_language(["Jeg elsker snø.","Eg elskar snø."])humit_tagger.identify_language(input_directory = "path/to/input/directory")1@inproceedings{haug-etal-2023-integrating,
2 title = "Rules and neural nets for morphological tagging of {N}orwegian - Results and challenges",
3 author = "Haug, Dag and
4 Yildirim, Ahmet and
5 Hagen, Kristin and
6 N{\o}klestad, Anders",
7 editor = {Alum{\"a}e, Tanel and
8 Fishel, Mark},
9 booktitle = "Proceedings of the 24th Nordic Conference on Computational Linguistics (NoDaLiDa)",
10 month = may,
11 year = "2023",
12 address = "T{\'o}rshavn, Faroe Islands",
13 publisher = "University of Tartu Library",
14 url = "https://aclanthology.org/2023.nodalida-1.43/",
15 pages = "425--435",
16 abstract = "This paper reports on efforts to improve the Oslo-Bergen Tagger for Norwegian morphological tagging. We train two deep neural network-based taggers using the recently introduced Norwegian pre-trained encoder (a BERT model for Norwegian). The first network is a sequence-to-sequence encoder-decoder and the second is a sequence classifier. We test both these configurations in a hybrid system where they combine with the existing rule-based system, and on their own. The sequence-to-sequence system performs better in the hybrid configuration, but the classifier system performs so well that combining it with the rules is actually slightly detrimental to performance."
17}