mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	Remove default initialize lookups
This commit is contained in:
		
							parent
							
								
									1700c8541e
								
							
						
					
					
						commit
						d48ddd6c9a
					
				| 
						 | 
				
			
			@ -3,21 +3,9 @@ from .punctuation import TOKENIZER_INFIXES, TOKENIZER_SUFFIXES
 | 
			
		|||
from .stop_words import STOP_WORDS
 | 
			
		||||
from .lex_attrs import LEX_ATTRS
 | 
			
		||||
from ...language import Language
 | 
			
		||||
from ...util import load_config_from_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFAULT_CONFIG = """
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DanishDefaults(Language.Defaults):
 | 
			
		||||
    config = load_config_from_str(DEFAULT_CONFIG)
 | 
			
		||||
    tokenizer_exceptions = TOKENIZER_EXCEPTIONS
 | 
			
		||||
    infixes = TOKENIZER_INFIXES
 | 
			
		||||
    suffixes = TOKENIZER_SUFFIXES
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,21 +3,9 @@ from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_SUFFIXES, TOKENIZER_INFIX
 | 
			
		|||
from .stop_words import STOP_WORDS
 | 
			
		||||
from .syntax_iterators import SYNTAX_ITERATORS
 | 
			
		||||
from ...language import Language
 | 
			
		||||
from ...util import load_config_from_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFAULT_CONFIG = """
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class GermanDefaults(Language.Defaults):
 | 
			
		||||
    config = load_config_from_str(DEFAULT_CONFIG)
 | 
			
		||||
    tokenizer_exceptions = TOKENIZER_EXCEPTIONS
 | 
			
		||||
    prefixes = TOKENIZER_PREFIXES
 | 
			
		||||
    suffixes = TOKENIZER_SUFFIXES
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,21 +9,9 @@ from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_SUFFIXES, TOKENIZER_INFIX
 | 
			
		|||
from .lemmatizer import GreekLemmatizer
 | 
			
		||||
from ...lookups import Lookups
 | 
			
		||||
from ...language import Language
 | 
			
		||||
from ...util import load_config_from_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFAULT_CONFIG = """
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class GreekDefaults(Language.Defaults):
 | 
			
		||||
    config = load_config_from_str(DEFAULT_CONFIG)
 | 
			
		||||
    tokenizer_exceptions = TOKENIZER_EXCEPTIONS
 | 
			
		||||
    prefixes = TOKENIZER_PREFIXES
 | 
			
		||||
    suffixes = TOKENIZER_SUFFIXES
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,21 +4,9 @@ from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
 | 
			
		|||
from .lex_attrs import LEX_ATTRS
 | 
			
		||||
from .syntax_iterators import SYNTAX_ITERATORS
 | 
			
		||||
from ...language import Language
 | 
			
		||||
from ...util import load_config_from_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFAULT_CONFIG = """
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class IndonesianDefaults(Language.Defaults):
 | 
			
		||||
    config = load_config_from_str(DEFAULT_CONFIG)
 | 
			
		||||
    tokenizer_exceptions = TOKENIZER_EXCEPTIONS
 | 
			
		||||
    prefixes = TOKENIZER_PREFIXES
 | 
			
		||||
    suffixes = TOKENIZER_SUFFIXES
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,21 +3,9 @@ from .punctuation import TOKENIZER_INFIXES
 | 
			
		|||
from .lex_attrs import LEX_ATTRS
 | 
			
		||||
from .stop_words import STOP_WORDS
 | 
			
		||||
from ...language import Language
 | 
			
		||||
from ...util import load_config_from_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFAULT_CONFIG = """
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class LuxembourgishDefaults(Language.Defaults):
 | 
			
		||||
    config = load_config_from_str(DEFAULT_CONFIG)
 | 
			
		||||
    tokenizer_exceptions = TOKENIZER_EXCEPTIONS
 | 
			
		||||
    infixes = TOKENIZER_INFIXES
 | 
			
		||||
    lex_attr_getters = LEX_ATTRS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,21 +3,9 @@ from .stop_words import STOP_WORDS
 | 
			
		|||
from .lex_attrs import LEX_ATTRS
 | 
			
		||||
from .punctuation import TOKENIZER_INFIXES, TOKENIZER_PREFIXES
 | 
			
		||||
from ...language import Language
 | 
			
		||||
from ...util import load_config_from_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFAULT_CONFIG = """
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class PortugueseDefaults(Language.Defaults):
 | 
			
		||||
    config = load_config_from_str(DEFAULT_CONFIG)
 | 
			
		||||
    tokenizer_exceptions = TOKENIZER_EXCEPTIONS
 | 
			
		||||
    infixes = TOKENIZER_INFIXES
 | 
			
		||||
    prefixes = TOKENIZER_PREFIXES
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,21 +7,9 @@ from .lex_attrs import LEX_ATTRS
 | 
			
		|||
from .lemmatizer import RussianLemmatizer
 | 
			
		||||
from ...language import Language
 | 
			
		||||
from ...lookups import Lookups
 | 
			
		||||
from ...util import load_config_from_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFAULT_CONFIG = """
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class RussianDefaults(Language.Defaults):
 | 
			
		||||
    config = load_config_from_str(DEFAULT_CONFIG)
 | 
			
		||||
    tokenizer_exceptions = TOKENIZER_EXCEPTIONS
 | 
			
		||||
    lex_attr_getters = LEX_ATTRS
 | 
			
		||||
    stop_words = STOP_WORDS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,21 +2,9 @@ from .stop_words import STOP_WORDS
 | 
			
		|||
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
 | 
			
		||||
from .lex_attrs import LEX_ATTRS
 | 
			
		||||
from ...language import Language
 | 
			
		||||
from ...util import load_config_from_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFAULT_CONFIG = """
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class SerbianDefaults(Language.Defaults):
 | 
			
		||||
    config = load_config_from_str(DEFAULT_CONFIG)
 | 
			
		||||
    tokenizer_exceptions = TOKENIZER_EXCEPTIONS
 | 
			
		||||
    lex_attr_getters = LEX_ATTRS
 | 
			
		||||
    stop_words = STOP_WORDS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,21 +1,9 @@
 | 
			
		|||
from .stop_words import STOP_WORDS
 | 
			
		||||
from .lex_attrs import LEX_ATTRS
 | 
			
		||||
from ...language import Language
 | 
			
		||||
from ...util import load_config_from_str
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DEFAULT_CONFIG = """
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TamilDefaults(Language.Defaults):
 | 
			
		||||
    config = load_config_from_str(DEFAULT_CONFIG)
 | 
			
		||||
    lex_attr_getters = LEX_ATTRS
 | 
			
		||||
    stop_words = STOP_WORDS
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,13 +10,6 @@ DEFAULT_CONFIG = """
 | 
			
		|||
 | 
			
		||||
[nlp.tokenizer]
 | 
			
		||||
@tokenizers = "spacy.th.ThaiTokenizer"
 | 
			
		||||
 | 
			
		||||
[initialize]
 | 
			
		||||
 | 
			
		||||
[initialize.lookups]
 | 
			
		||||
@misc = "spacy.LookupsDataLoader.v1"
 | 
			
		||||
lang = ${nlp.lang}
 | 
			
		||||
tables = ["lexeme_norm"]
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -339,7 +339,6 @@ def test_ner_warns_no_lookups(caplog):
 | 
			
		|||
    nlp.vocab.lookups = Lookups()
 | 
			
		||||
    assert not len(nlp.vocab.lookups)
 | 
			
		||||
    nlp.add_pipe("ner")
 | 
			
		||||
    nlp.config["initialize"]["lookups"] = None
 | 
			
		||||
    with caplog.at_level(logging.DEBUG):
 | 
			
		||||
        nlp.initialize()
 | 
			
		||||
        assert "W033" in caplog.text
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user