nlp

What does the “source hidden state” refer to in the Attention Mechanism?

爱⌒轻易说出口 提交于 2020-01-24 10:29:06
问题 The attention weights are computed as: I want to know what the h_s refers to. In the tensorflow code, the encoder RNN returns a tuple: encoder_outputs, encoder_state = tf.nn.dynamic_rnn(...) As I think, the h_s should be the encoder_state , but the github/nmt gives a different answer? # attention_states: [batch_size, max_time, num_units] attention_states = tf.transpose(encoder_outputs, [1, 0, 2]) # Create an attention mechanism attention_mechanism = tf.contrib.seq2seq.LuongAttention( num

What does the “source hidden state” refer to in the Attention Mechanism?

非 Y 不嫁゛ 提交于 2020-01-24 10:29:05
问题 The attention weights are computed as: I want to know what the h_s refers to. In the tensorflow code, the encoder RNN returns a tuple: encoder_outputs, encoder_state = tf.nn.dynamic_rnn(...) As I think, the h_s should be the encoder_state , but the github/nmt gives a different answer? # attention_states: [batch_size, max_time, num_units] attention_states = tf.transpose(encoder_outputs, [1, 0, 2]) # Create an attention mechanism attention_mechanism = tf.contrib.seq2seq.LuongAttention( num

What does concatenate layers do in Keras multitask?

折月煮酒 提交于 2020-01-24 01:16:06
问题 I am implementing a simple multitask model in Keras. I used the code given in the documentation under the heading of shared layers . I know that in multitask learning, we share some of the initial layers in our model and the final layers are made individual to the specific tasks as per the link. I have following two cases in keras API where in the first, I am using keras.layers.concatenate while in the other, I am not using any keras.layers.concatenate . I am posting the codes as well as the

What are the spell correct api's available? [closed]

北战南征 提交于 2020-01-24 00:30:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I wanted to know the spell correct api's available for commercial/non commercial usage other than google/bing. 回答1: First of all you can write your own spell corrector with this tutorial. In addition there are some Python packages that may help you with that, such as TextBlob (which I highly recommend). Another

train a language model using Google Ngrams

痞子三分冷 提交于 2020-01-23 18:00:08
问题 I want to find a conditional probability of a word given its previous set of words. I plan to use Google N-grams for the same. However, being such a huge resource as it is, I don't think it is computationally possible to do on my PC. ( To process all N-grams, to train a language model). So is there any way I can train a language model using Google Ngrams ? (Even python NLTK library does not support ngram language model anymore) Note - I know that a language model can be trained using ngrams,

Stanford classifier cross validation averaged or aggregate metrics

天大地大妈咪最大 提交于 2020-01-23 17:21:12
问题 With Stanford Classifier it is possible to use cross validation by setting the options in the properties file, such as this for 10-fold cross validation: crossValidationFolds=10 printCrossValidationDecisions=true shuffleTrainingData=true shuffleSeed=1 Running this will output, per fold, the various metrics, such as precision, recall, Accuracy/micro-averaged F1 and Macro-averaged F1. Is there an option to get an averaged or otherwise aggregated score of all 10 Accuracy/micro-averaged F1 or all

OpenNLP: Training a custom NER Model for multiple entities

妖精的绣舞 提交于 2020-01-23 10:59:34
问题 I am trying training a custom NER model for multiple entities. Here is the sample training data: count all <START:item_type> operating tables <END> on the <START:location_id> third <END> <START:location_type> floor <END> count all <START:item_type> items <END> on the <START:location_id> third <END> <START:location_type> floor <END> how many <START:item_type> beds <END> are in <START:location_type> room <END> <START:location_id> 2 <END> The NameFinderME.train(.) method takes a string parameter

OpenNLP: Training a custom NER Model for multiple entities

泄露秘密 提交于 2020-01-23 10:59:22
问题 I am trying training a custom NER model for multiple entities. Here is the sample training data: count all <START:item_type> operating tables <END> on the <START:location_id> third <END> <START:location_type> floor <END> count all <START:item_type> items <END> on the <START:location_id> third <END> <START:location_type> floor <END> how many <START:item_type> beds <END> are in <START:location_type> room <END> <START:location_id> 2 <END> The NameFinderME.train(.) method takes a string parameter

Speech Recognition duration setting issue in python

此生再无相见时 提交于 2020-01-23 09:55:39
问题 I have an audio file in Wav format that I want to transcribe: My code is: import speech_recognition as sr harvard = sr.AudioFile('speech_file.wav') with harvard as source: try: audio = r.listen(source) #print("Done") except sr.UnknownValueError: exec() r.recognize_google(audio) I do receive an output: Out[20]: 'thank you for calling my name is Denise who I have a pleasure speaking with hi my name is Mary Jane. Good afternoon Mary Jane I do have your account open with your email' However,

Merge two dot graphs at a common node in python

前提是你 提交于 2020-01-23 04:09:07
问题 The dependency-parsed output (using Stanford Parser) of the following two sentences are as follows. Sentence 1 - John is a computer scientist Dot format - digraph G{ edge [dir=forward] node [shape=plaintext] 0 [label="0 (None)"] 0 -> 5 [label="root"] 1 [label="1 (John)"] 2 [label="2 (is)"] 3 [label="3 (a)"] 4 [label="4 (computer)"] 5 [label="5 (scientist)"] 5 -> 2 [label="cop"] 5 -> 4 [label="compound"] 5 -> 3 [label="det"] 5 -> 1 [label="nsubj"] } Graph - Sentence 2 - John has an elder