-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
228 additions
and
439 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//----------------------------------------------------------------------------- | ||
// MurmurHash2 was written by Austin Appleby, and is placed in the public | ||
// domain. The author hereby disclaims copyright to this source code. | ||
|
||
#ifndef _MURMURHASH2_H_ | ||
#define _MURMURHASH2_H_ | ||
|
||
#include <stdint.h> | ||
|
||
//----------------------------------------------------------------------------- | ||
|
||
uint32_t MurmurHash2 ( const void * key, int len, uint32_t seed ); | ||
uint64_t MurmurHash64A ( const void * key, int len, uint64_t seed ); | ||
uint64_t MurmurHash64B ( const void * key, int len, uint64_t seed ); | ||
uint32_t MurmurHash2A ( const void * key, int len, uint32_t seed ); | ||
uint32_t MurmurHashNeutral2 ( const void * key, int len, uint32_t seed ); | ||
uint32_t MurmurHashAligned2 ( const void * key, int len, uint32_t seed ); | ||
|
||
//----------------------------------------------------------------------------- | ||
|
||
#endif // _MURMURHASH2_H_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//----------------------------------------------------------------------------- | ||
// MurmurHash3 was written by Austin Appleby, and is placed in the public | ||
// domain. The author hereby disclaims copyright to this source code. | ||
|
||
#ifndef _MURMURHASH3_H_ | ||
#define _MURMURHASH3_H_ | ||
|
||
#include <stdint.h> | ||
|
||
//----------------------------------------------------------------------------- | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
|
||
void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out ); | ||
|
||
void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out ); | ||
|
||
void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out ); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
//----------------------------------------------------------------------------- | ||
|
||
#endif // _MURMURHASH3_H_ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,69 @@ | ||
# coding: utf8 | ||
from __future__ import unicode_literals | ||
""" | ||
Simple check list from AllenNLP repo: https://github.com/allenai/allennlp/blob/master/setup.py | ||
To create the package for pypi. | ||
1. Change the version in __init__.py and setup.py. | ||
2. Commit these changes with the message: "Release: VERSION" | ||
3. Add a tag in git to mark the release: "git tag VERSION -m'Adds tag VERSION for pypi' " | ||
Push the tag to git: git push --tags origin master | ||
4. Build both the sources and the wheel. Do not change anything in setup.py between | ||
creating the wheel and the source distribution (obviously). | ||
For the wheel, run: "python setup.py bdist_wheel" in the top level allennlp directory. | ||
(this will build a wheel for the python version you use to build it - make sure you use python 3.x). | ||
For the sources, run: "python setup.py sdist" | ||
You should now have a /dist directory with both .whl and .tar.gz source versions of allennlp. | ||
5. Check that everything looks correct by uploading the package to the pypi test server: | ||
twine upload dist/* -r pypitest | ||
(pypi suggest using twine as other methods upload files via plaintext.) | ||
Check that you can install it in a virtualenv by running: | ||
pip install -i https://testpypi.python.org/pypi neuralcoref | ||
6. Upload the final version to actual pypi: | ||
twine upload dist/* -r pypi | ||
7. Copy the release notes from RELEASE.md to the tag in github once everything is looking hunky-dory. | ||
""" | ||
from __future__ import unicode_literals, absolute_import | ||
|
||
import os | ||
import shutil | ||
import tarfile | ||
import tempfile | ||
import logging | ||
|
||
from .neuralcoref import NeuralCoref | ||
from .file_utils import NEURALCOREF_CACHE, cached_path | ||
from .file_utils import NEURALCOREF_MODEL_URL, NEURALCOREF_MODEL_PATH, NEURALCOREF_CACHE, cached_path | ||
|
||
__all__ = ['NeuralCoref'] | ||
__all__ = ['NeuralCoref', 'add_to_pipe'] | ||
__version__ = "4.0.0" | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
MODEL_URL = "https://s3.amazonaws.com/models.huggingface.co/neuralcoref/neuralcoref_model.tar.gz" | ||
LOCAL_PATH = os.path.join(str(NEURALCOREF_CACHE), "/neuralcoref/") | ||
|
||
try: | ||
local_model = cached_path(LOCAL_PATH) | ||
except: | ||
os.makedirs(LOCAL_PATH) | ||
downloaded_model = cached_path(MODEL_URL) | ||
if os.path.exists(NEURALCOREF_MODEL_PATH) and os.path.exists(os.path.join(NEURALCOREF_MODEL_PATH, "cfg")): | ||
logger.info("Loading model from {}".format(NEURALCOREF_MODEL_PATH)) | ||
local_model = cached_path(NEURALCOREF_MODEL_PATH) | ||
else: | ||
if not os.path.exists(NEURALCOREF_MODEL_PATH): | ||
os.makedirs(NEURALCOREF_MODEL_PATH) | ||
logger.info("Getting model from {} or cache".format(NEURALCOREF_MODEL_URL)) | ||
downloaded_model = cached_path(NEURALCOREF_MODEL_URL) | ||
|
||
logger.info("extracting archive file {} to dir {}".format(downloaded_model, LOCAL_PATH)) | ||
logger.info("extracting archive file {} to dir {}".format(downloaded_model, NEURALCOREF_MODEL_PATH)) | ||
with tarfile.open(downloaded_model, 'r:gz') as archive: | ||
archive.extractall(LOCAL_PATH) | ||
archive.extractall(NEURALCOREF_CACHE) | ||
|
||
def add_to_pipe(nlp): | ||
coref = NeuralCoref(nlp.vocab) | ||
nlp.add_pipe(coref, name='neuralcoref') | ||
return nlp |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.