Download inputs/fields/field.py from deepcode-ai/Compact_Facts: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/deepcode-ai/Compact_Facts/resolve/main/inputs/fields/field.py
- Command line
-
hf download hf://deepcode-ai/Compact_Facts/inputs/fields/field.py
-
curl -L -o field.py https://huggingface.co/deepcode-ai/Compact_Facts/resolve/main/inputs/fields/field.py
1.03 kB
| from abc import ABC, abstractclassmethod | |
| class Field(ABC): | |
| """Abstract class `Field` define one indexing method, | |
| genenrate counter from raw text data and index token in raw text data | |
| Arguments: | |
| ABC {ABC} -- abstract base class | |
| """ | |
| def count_vocab_items(self, counter, sentences): | |
| """This function constructs counter using each sentence content, | |
| prepare for vocabulary | |
| Arguments: | |
| counter {dict} -- element count dict | |
| sentences {list} -- text data | |
| """ | |
| raise NotImplementedError | |
| def index(self, instance, voacb, sentences): | |
| """This function constrcuts instance using sentences and vocabulary, | |
| each namespace is a mappping method using different type data | |
| Arguments: | |
| instance {dict} -- collections of various fields | |
| voacb {dict} -- vocabulary | |
| sentences {list} -- text data | |
| """ | |
| raise NotImplementedError | |