repp / big-phoney Goto Github PK
View Code? Open in Web Editor NEWGet phonetic spellings and syllable counts for any english word. Works with made-up and non-dictionary words
License: GNU General Public License v3.0
Get phonetic spellings and syllable counts for any english word. Works with made-up and non-dictionary words
License: GNU General Public License v3.0
I tried installing big-phoney both through pip and also wheel installation. But when I import the package in my program. It says module not found error.
install big-phoney package either with pip or .whl file installation and try to import the package in your python file.
Hi,
I have installed the library and tried:
from big_phoney import BigPhoney
phoney = BigPhoney()
but this produces the following error:
/Users/rlujo/env/tmp2/phoney/lib/python2.7/site-packages/big_phoney/utils.pyc in load_pickle_dict(dict_path)
61 def load_pickle_dict(dict_path):
62 if not os.path.isfile(dict_path):
---> 63 raise FileNotFoundError('The dictionary file is missing. Generate it by running '
64 '`python dev/generate_dictionaries.py`')
global name 'FileNotFoundError' is not defined
from big_phoney import BigPhoney
p = BigPhoney()
2020-06-29 17:22:37.950128: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-06-29 17:22:37.965589: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fa9bae19a30 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-29 17:22:37.965621: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/big_phoney.py", line 15, in init
self.pred_model = PredictionModel()
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/prediction_model.py", line 16, in init
self.training_model, self.encoder, self.decoder = self._build_model()
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/prediction_model.py", line 75, in _build_model
context = get_context(encoder_outputs, h)
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/prediction_model.py", line 38, in get_context
context = attn_dot([attention_weights, encoder_outputs])
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 897, in call
self._maybe_build(inputs)
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 2416, in _maybe_build
self.build(input_shapes) # pylint:disable=not-callable
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/utils/tf_utils.py", line 316, in wrapper
output_shape = fn(instance, input_shape)
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/layers/merge.py", line 677, in build
'Chosen axes: %s, %s' % (axes[0], axes[1]))
ValueError: Dimension incompatibility 20 != None. Layer shapes: (None, 20, 1), (None, None, 512). Chosen axes: 1, 1
Any ideas? Tensorflow is version 2.2 and keras is up to date
All the tensorflow debug seems good, but then I get:
Traceback (most recent call last):
File "test.py", line 3, in
phoney = BigPhoney()
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\big_phoney-1.0.1-py3.7.egg\big_phoney\big_phoney.py", line 15, in init
self.pred_model = PredictionModel()
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\big_phoney-1.0.1-py3.7.egg\big_phoney\prediction_model.py", line 16, in init
self.training_model, self.encoder, self.decoder = self._build_model()
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\big_phoney-1.0.1-py3.7.egg\big_phoney\prediction_model.py", line 75, in _build_model
context = get_context(encoder_outputs, h)
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\big_phoney-1.0.1-py3.7.egg\big_phoney\prediction_model.py", line 38, in get_context
context = attn_dot([attention_weights, encoder_outputs])
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 926, in call
input_list)
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 1098, in _functional_construction_call
self._maybe_build(inputs)
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 2643, in _maybe_build
self.build(input_shapes) # pylint:disable=not-callable
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\utils\tf_utils.py", line 323, in wrapper
output_shape = fn(instance, input_shape)
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\layers\merge.py", line 680, in build
'Chosen axes: %s, %s' % (axes[0], axes[1]))
ValueError: Dimension incompatibility 20 != None. Layer shapes: (None, 20, 1), (None, None, 512). Chosen axes: 1, 1
Hello!
Thanks for the initiative to bring this open source project.
I was on the way to give it a try, and found the error while executing the following line after importing the module successfully.
phoney = BigPhoney()
The error generated is mentioned below. Numpy 1.19.5 is installed. Any help towards resolution would be appreciated.
`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
----> 1 phoney = BigPhoney(preprocessors=[])
~/anaconda3/lib/python3.7/site-packages/big_phoney/big_phoney.py in init(self, preprocessors)
13 self.preprocessors = [preprocessor_class() for preprocessor_class in preprocessors]
14 self.phonetic_dict = PhoneticDictionary()
---> 15 self.pred_model = PredictionModel()
16
17 def apply_preprocessors(self, input_string):
~/anaconda3/lib/python3.7/site-packages/big_phoney/prediction_model.py in init(self, search_width)
14 self.search_width = search_width
15 self.utils = PredictionModelUtils()
---> 16 self.training_model, self.encoder, self.decoder = self._build_model()
17 self.load_weights(PREDICTION_MODEL_WEIGHTS_PATH)
18
~/anaconda3/lib/python3.7/site-packages/big_phoney/prediction_model.py in _build_model(self)
73 phone_embeddings = embedding_reshaper(phone_embeddings)
74
---> 75 context = get_context(encoder_outputs, h)
76 phone_and_context = context_phone_concat([context, phone_embeddings])
77 phone_and_context = context_phone_dense(phone_and_context)
~/anaconda3/lib/python3.7/site-packages/big_phoney/prediction_model.py in get_context(encoder_outputs, h_prev)
36 e = attn_dense2(e)
37 attention_weights = attn_softmax(e)
---> 38 context = attn_dot([attention_weights, encoder_outputs])
39 return context
40
~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
950 if _in_functional_construction_mode(self, inputs, args, kwargs, input_list):
951 return self._functional_construction_call(inputs, args, kwargs,
--> 952 input_list)
953
954 # Maintains info about the Layer.call
stack.
~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list)
1089 # Check input assumptions set after layer building, e.g. input shape.
1090 outputs = self._keras_tensor_symbolic_call(
-> 1091 inputs, input_masks, args, kwargs)
1092
1093 if outputs is None:
~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _keras_tensor_symbolic_call(self, inputs, input_masks, args, kwargs)
820 return nest.map_structure(keras_tensor.KerasTensor, output_signature)
821 else:
--> 822 return self._infer_output_signature(inputs, args, kwargs, input_masks)
823
824 def _infer_output_signature(self, inputs, args, kwargs, input_masks):
~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _infer_output_signature(self, inputs, args, kwargs, input_masks)
860 # overridden).
861 # TODO(kaftan): do we maybe_build here, or have we already done it?
--> 862 self._maybe_build(inputs)
863 outputs = call_fn(inputs, *args, **kwargs)
864
~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _maybe_build(self, inputs)
2708 # operations.
2709 with tf_utils.maybe_init_scope(self):
-> 2710 self.build(input_shapes) # pylint:disable=not-callable
2711 # We must set also ensure that the layer is marked as built, and the build
2712 # shape is stored since user defined build functions may not be calling
~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/utils/tf_utils.py in wrapper(instance, input_shape)
270 if input_shape is not None:
271 input_shape = convert_shapes(input_shape, to_tuples=True)
--> 272 output_shape = fn(instance, input_shape)
273 # Return shapes from fn
as TensorShapes.
274 if output_shape is not None:
~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/layers/merge.py in build(self, input_shape)
678 '%s != %s. ' % (shape1[axes[0]], shape2[axes[1]]) +
679 'Layer shapes: %s, %s. ' % (shape1, shape2) +
--> 680 'Chosen axes: %s, %s' % (axes[0], axes[1]))
681
682 def _merge_function(self, inputs):
ValueError: Dimension incompatibility 20 != None. Layer shapes: (None, 20, 1), (None, None, 512). Chosen axes: 1, 1
`
Thanks for this awesome project ! I found a preprocess issue:
print(phoney.phonize("$234.009"))
print(phoney.phonize("$234.09"))
#T UW1 HH AH1 N D R AH0 D AH0 N D TH ER1 D IY2 F AO1 R D AA1 L ER0 Z AH0 N D N AY1 N S EH1 N T S
the two lines return the same phoneme sequence, but $234.009 not equals $234.09. This situation is strictly differentiated in financial scenarios.
Unfortunately, I cannot run your library on my Mac. I do not own a Linux or Windows machine. Are you planning to adapt it?
Is it possible to split input into syllables, rather than just counting them? If so, how do you do that? If not, this is a feature suggestion.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.