mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	Merge branch 'develop' of https://github.com/explosion/spaCy into develop
This commit is contained in:
		
						commit
						94df115a81
					
				| 
						 | 
					@ -105,8 +105,11 @@ def generate_pipeline():
 | 
				
			||||||
           "parser, ner. For more information, see the docs on processing pipelines.",
 | 
					           "parser, ner. For more information, see the docs on processing pipelines.",
 | 
				
			||||||
           title="Enter your model's pipeline components")
 | 
					           title="Enter your model's pipeline components")
 | 
				
			||||||
    pipeline = util.get_raw_input("Pipeline components", True)
 | 
					    pipeline = util.get_raw_input("Pipeline components", True)
 | 
				
			||||||
    replace = {'True': True, 'False': False}
 | 
					    subs = {'True': True, 'False': False}
 | 
				
			||||||
    return replace[pipeline] if pipeline in replace else pipeline.split(', ')
 | 
					    if pipeline in subs:
 | 
				
			||||||
 | 
					        return subs[pipeline]
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        return [p.strip() for p in pipeline.split(',')]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def validate_meta(meta, keys):
 | 
					def validate_meta(meta, keys):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -181,9 +181,10 @@ def is_package(name):
 | 
				
			||||||
    name (unicode): Name of package.
 | 
					    name (unicode): Name of package.
 | 
				
			||||||
    RETURNS (bool): True if installed package, False if not.
 | 
					    RETURNS (bool): True if installed package, False if not.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					    name = name.lower()  # compare package name against lowercase name
 | 
				
			||||||
    packages = pkg_resources.working_set.by_key.keys()
 | 
					    packages = pkg_resources.working_set.by_key.keys()
 | 
				
			||||||
    for package in packages:
 | 
					    for package in packages:
 | 
				
			||||||
        if package.replace('-', '_') == name:
 | 
					        if package.lower().replace('-', '_') == name:
 | 
				
			||||||
            return True
 | 
					            return True
 | 
				
			||||||
    return False
 | 
					    return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -194,6 +195,7 @@ def get_package_path(name):
 | 
				
			||||||
    name (unicode): Package name.
 | 
					    name (unicode): Package name.
 | 
				
			||||||
    RETURNS (Path): Path to installed package.
 | 
					    RETURNS (Path): Path to installed package.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					    name = name.lower()  # use lowercase version to be safe
 | 
				
			||||||
    # Here we're importing the module just to find it. This is worryingly
 | 
					    # Here we're importing the module just to find it. This is worryingly
 | 
				
			||||||
    # indirect, but it's otherwise very difficult to find the package.
 | 
					    # indirect, but it's otherwise very difficult to find the package.
 | 
				
			||||||
    pkg = importlib.import_module(name)
 | 
					    pkg = importlib.import_module(name)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user