category
stringclasses
107 values
title
stringlengths
15
179
question_link
stringlengths
59
147
question_body
stringlengths
53
33.8k
answer_html
stringlengths
0
28.8k
__index_level_0__
int64
0
1.58k
text classification
Multinomial Naive Bayes in Text Classification
https://stackoverflow.com/questions/40394828/multinomial-naive-bayes-in-text-classification
<p>I have a set of features in which one of the features is a negative value. I intend to use Multinomial Naive Bayes for classification of my text document but the negative feature throws an error. Can I use Gaussian Naive Bayes for this setting of text classification?</p>
1,234
text classification
training libsvm for text classification(sentiment)
https://stackoverflow.com/questions/10734728/training-libsvm-for-text-classificationsentiment
<p>From following links I came with some idea. I want to ask whether I am doing it right or I am in the wrong way. If I am in the wrong way, please guide me.</p> <p>Links<br/> <a href="https://stackoverflow.com/questions/9021658/using-libsvm-for-text-classification-c-sharp">Using libsvm for text classification c#</a><...
<p>You're doing it right.</p> <p>I don't know why your laben is called "+1" - should be a simple integer (refering to the document "+ve"), but all in all it's the way to go. </p> <p>For document classification you may want to take a look at liblinear which is specially designed for handling a lot of features.</p>
1,235
text classification
Feature Construction for Text Classification using Autoencoders
https://stackoverflow.com/questions/24159098/feature-construction-for-text-classification-using-autoencoders
<p>Autoencoders can be used to reduce dimensionallity in feature vectors - as far as I understand. In text classification a feature vector is normally constructed via a dictionary - which tends to be extremely large. I have no experience in using autoencoders, so my questions are:</p> <ol> <li>Could autoencoders be us...
<p>The existing works use auto encoder for creating models in the sentence level. Basically after training the model using Autoencode, you can get a vector for a sentence. Since any document consists of sentences you can get a set of vectors for the document, and do the document classification. In my experience with va...
1,236
text classification
Collocations in text classification
https://stackoverflow.com/questions/8102770/collocations-in-text-classification
<p>Suppose i have trained my classifier and i want to find the right sense of a word in a sentence. One feature people use is called collocation where you consider words to the left/right of the confusing word and position is important . I am curious why this approach works? What information does considering collocatio...
<p>Check some details on why word sense disambiguation using collocation works here: <a href="http://en.wikipedia.org/wiki/Yarowsky_algorithm" rel="nofollow">http://en.wikipedia.org/wiki/Yarowsky_algorithm</a> It's basically a Bayesian network.</p>
1,237
text classification
Text classification for russian language
https://stackoverflow.com/questions/18011756/text-classification-for-russian-language
<p>I faced a problem with text classification where I need to classify russian texts. For feature extraction, I use scikit learn TfidfTransformer and CountVectorizer, but after compiling the code there is a mistake:</p> <pre><code>'UnicodeDecodeError: 'utf8' codec can't decode byte 0xc2 in position 0: invalid continu...
<p>Set the <code>charset</code> (or in 0.14, <code>encoding</code>) parameter on the vectorizer. For Russian text, that would probably be</p> <pre><code>CountVectorizer(charset='koi8r', stop_words=stopWords) </code></pre> <p>(but don't take my word for it and run something like <code>chardet</code> or <code>file</cod...
1,238
text classification
Python Text Classification Error - expected string or bytes-like object
https://stackoverflow.com/questions/44365435/python-text-classification-error-expected-string-or-bytes-like-object
<p>I'm trying to do text classification for a large corpus (732,066 tweets) in python</p> <pre><code># Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset #dataset = pd.read_csv('Restaurant_Reviews.tsv', delimiter = '\t', quoting = 3) # Importing the...
<p>Try</p> <pre><code>str(dataset.loc[df.index[i], 'text']) </code></pre> <p>That'll convert it to a str object, from whatever type it was before.</p>
1,239
text classification
Text classification performance
https://stackoverflow.com/questions/37969425/text-classification-performance
<p>So i am using textblob python library, but the performance is lacking.</p> <p>I already serialize it and load it before the loop( using pickle ).</p> <p>It currently takes ~ 0.1( for small training data ) and ~ 0.3 on 33'000 test data. I need to make it faster, is it even possible ?</p> <h1><strong>Some code:</st...
<p>You can use feature selection for your data. some good feature selection can reduce features up to 90% and persist the classification performance. In feature selection you select top feature(in <strong>Bag Of Word</strong> model, you select top influence words), and train model based on these words(features). this r...
1,240
text classification
Neural networks for Text Classification
https://stackoverflow.com/questions/33458682/neural-networks-for-text-classification
<p>I am trying to train a model on text classification. I have a large labeled dataset. I have tried scikit classifiers NaiveBayes, KNeighborsClassifier, RandomForest etc. But i cannot get an accuracy above 30%. How can i use the Neural Networks for text classification? Here is the algo i have used so far</p> <pre>...
<p>You need to improve the quality of your features. I suggest you form a new question around how to design features for this problem before dealing with the classifier algorithm. From the bad accuracy you report using a few methods, and the description that should be the weakest point you address first.</p>
1,241
text classification
Text classification with Tensorflow_Hub
https://stackoverflow.com/questions/54055415/text-classification-with-tensorflow-hub
<p>I'm following this tutorial <a href="https://medium.com/tensorflow/building-a-text-classification-model-with-tensorflow-hub-and-estimators-3169e7aa568" rel="nofollow noreferrer">https://medium.com/tensorflow/building-a-text-classification-model-with-tensorflow-hub-and-estimators-3169e7aa568</a> on how to build text ...
1,242
text classification
New techniques of text classification nlp
https://stackoverflow.com/questions/59007277/new-techniques-of-text-classification-nlp
<p>I have to make a text classification program with new techniques (Not using "bag of words" and "TF-IDF"). I read about EDA but I was confused. Any ideas?</p>
1,243
text classification
Feature Selection for Text Classification
https://stackoverflow.com/questions/19220621/feature-selection-for-text-classification
<p>I am working on a text classification problem in which the 100 most frequent words are selected as features. I believe the results could be improved if I use a better feature selection method? Any ideas? Could TF-IDF work? If yes, then how?</p>
<p>to improve the results you can use Feature selection </p> <p>1) Information gain </p> <p>2) Chi square</p> <p>3) Mutual information</p> <p>4) Term frequency</p> <p>TF-IDF you can see this <a href="http://www.tfidf.com/" rel="nofollow">link</a> it will help you </p>
1,244
text classification
SQL/BigQuery text classification
https://stackoverflow.com/questions/64881264/sql-bigquery-text-classification
<p>I need to implement a simple text classification using regex, and for this I thought to apply a simple CASE WHEN statement, but rather than in case one condition is met, I want to iterate over all the CASEs.</p> <p>For example,</p> <pre class="lang-sql prettyprint-override"><code>with `table` as( SELECT 'It is unden...
<p>I feel the below is the most generic and reusable solution (BigQuery Standard SQL):</p> <pre><code>#standardSQL with `table` as( select 'It is undeniable that AI will change the landscape of the future. There is a frequent increase in the demand for AI-related jobs, especially in data science and machine learning po...
1,245
text classification
Error while creating a model for binary classification for text classification
https://stackoverflow.com/questions/71850436/error-while-creating-a-model-for-binary-classification-for-text-classification
<p>code:</p> <pre><code>model = create_model() model.compile(optimize=tf.keras.optimizers.Adam(learning_rate=2e-5), loss=tf.keras.losses.BinaryCrossentropy(), metrics=[tf.keras.metrics.BinaryAccuracy()]) model.summary() </code></pre> <p>error:</p> <pre><code>TypeError ...
<p>I was able to replicate above issue using sample code as shown below</p> <pre><code>import numpy as np import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras.optimizers import Adam c = np.array([-40, -10, -0, 8, 15, 22, 38]) f = np.arr...
1,246
text classification
python textblob and text classification
https://stackoverflow.com/questions/33883976/python-textblob-and-text-classification
<p>I'm trying do build a text classification model with python and <a href="https://textblob.readthedocs.org/en/dev/index.html" rel="nofollow noreferrer">textblob</a>, the script is runing on my server and in the future the idea is that users will be able to submit their text and it will be classified. i'm loading the ...
<p>Ok found that pickle module is what i need :)</p> <p>Training:</p> <pre><code># -*- coding: utf-8 -*- import pickle from nltk.tokenize import word_tokenize from textblob.classifiers import NaiveBayesClassifier with open('file.csv', 'r', encoding='latin-1') as fp: cl = NaiveBayesClassifier(fp, format="csv") ...
1,247
text classification
R Text Classification with 800K documents
https://stackoverflow.com/questions/40809626/r-text-classification-with-800k-documents
<p>I have to do some work on text classification that contains 800K texts. I've been trying to run an practical example I found in the following link:</p> <p><a href="http://garonfolo.dk/herbert/2015/05/r-text-classification-using-a-k-nearest-neighbour-model/" rel="nofollow noreferrer">http://garonfolo.dk/herbert/2015...
<p>Before that <code>as.data.frame()</code> call, enter this line of code:</p> <p><code>dtm &lt;- removeSparseTerms(dtm, sparse=0.9)</code>. </p> <p>The argument <code>sparse=...</code> is a number between 0 and 1. It is proportional to the number of documents you want to keep. Above, it is <em>not</em> 90%. Typicall...
1,248
text classification
How to export a Google AutoML Text Classification model?
https://stackoverflow.com/questions/70637913/how-to-export-a-google-automl-text-classification-model
<p>I just finished training my AutoML Text Classification model (single-label).</p> <p>I was planning to run a Batch Prediction using the console, but I just found out how expensive that will be because I have over 300,000 text records to analyze.</p> <p>So now I want to export the model to my local machine and run the...
<ol> <li><p>Currently, there is no feature to export an AutoML text classification model. Already a feature request exists, you can follow its progress on this <a href="https://issuetracker.google.com/168860629" rel="nofollow noreferrer">issue tracker</a>.</p> </li> <li><p>Both the models are quite similar. A tabular d...
1,249
text classification
Word Embedding for text classification
https://stackoverflow.com/questions/64331013/word-embedding-for-text-classification
<p>I am new in the NLP community and need more light on something.</p> <p>I saw that Keras has an Embedding layer that is generally used before the LSTM layer. But what algorithm hides behind it? Is it Word2Vec, Glove or something else?</p> <p>My task is a supervised text classification problem.</p>
<p>The embedding layer is a randomly initialized matrix, with the dimension of <code>(number_of_words_in_vocab * embedding_dimension)</code>. The <code>embedding_dimension</code> is custom defined dimension, and an hyper-parmeter that we will have to choose.</p> <p>Here, the embeddings are updated during back-propagati...
1,250
text classification
FastText using pre-trained word vector for text classification
https://stackoverflow.com/questions/47692906/fasttext-using-pre-trained-word-vector-for-text-classification
<p>I am working on a text classification problem, that is, given some text, I need to assign to it certain given labels.</p> <p>I have tried using fast-text library by Facebook, which has two utilities of interest to me:</p> <p>A) Word Vectors with pre-trained models</p> <p>B) Text Classification utilities</p> <p>H...
<p>FastText's native classification mode depends on you training the word-vectors yourself, using texts with known classes. The word-vectors thus become optimized to be useful for the specific classifications observed during training. So that mode typically <em>wouldn't</em> be used with pre-trained vectors. </p> <p>I...
1,251
text classification
Text Classification: Multilable Text Classification vs Multiclass Text Classification
https://stackoverflow.com/questions/35737352/text-classification-multilable-text-classification-vs-multiclass-text-classific
<p>I have a question about the approach to deal with a multilabel classification problem.</p> <p>Based on literature review, I found one most commonly-used approach is Problem Transformation Approach. It transformed the multilabel problem to a number of single label problems, and the classification result is just the ...
<p>what you describe is a known transformation strategy to multi-class problems called Label Power Set Transformation Strategy.</p> <p>Drawbacks of this method:</p> <ul> <li>The LP transformation may lead to up to 2^|L| transformed labels.</li> <li>Class imbalance problem.</li> </ul> <p><strong>Refer to: Cherman, Ev...
1,252
text classification
How to use Transformers for text classification?
https://stackoverflow.com/questions/58123393/how-to-use-transformers-for-text-classification
<p>I have two questions about how to use Tensorflow implementation of the Transformers for text classifications. </p> <ul> <li><strong>First</strong>, it seems people mostly used only the encoder layer to do the text classification task. However, encoder layer generates one prediction for each input word. Based on my ...
<p>There are two approaches, you can take:</p> <ol> <li>Just average the states you get from the encoder;</li> <li>Prepend a special token <code>[CLS]</code> (or whatever you like to call it) and use the hidden state for the special token as input to your classifier.</li> </ol> <p>The second approach is used by <a hr...
1,253
text classification
custom pytorch dataloader within fastai text classification
https://stackoverflow.com/questions/70174383/custom-pytorch-dataloader-within-fastai-text-classification
<p>I am trying to go deeper in my understanding of fastai API and want to be able to implement some things in “pure” pytorch and then let fastai do all of the optimization tricks.</p> <p>I am trying simple text classification with my own dataloader class. Firstly, I still get error when I try to show one batch getting ...
1,254
text classification
Scikit Learn-MultinomialNB for text classification
https://stackoverflow.com/questions/46014642/scikit-learn-multinomialnb-for-text-classification
<p>How to Calculate FPR, TPR, AUC, roc_curve for multi class text classification.</p> <p>I have used following code:</p> <pre><code>from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42) from sklearn.feature_extraction.text import CountVectorizer ...
<p><code>roc_curve</code> doesnt support multiclass format. You have to calculate for binary class.</p> <p>But to calculate FPR, TPR you can use <code>confusion_matrix</code></p> <pre><code>from sklearn.metrics import confusion_matrix y_test = np.argmax(y_test, axis=1) y_score = np.argmax(y_score, axis=1) c = confusi...
1,255
text classification
looking for training data for text classification
https://stackoverflow.com/questions/15999713/looking-for-training-data-for-text-classification
<p>I am looking for training data for text classification into categories like sports, finance, politics, music, etc.</p> <p>Please guide to references. Hello.</p>
<p>You can get a Reuters corpus by applying at <a href="http://trec.nist.gov/data/reuters/reuters.html" rel="nofollow">Reuters</a></p> <p>You can also get the Technion Text Repository <a href="http://techtc.cs.technion.ac.il/techtc300/techtc300.html#software" rel="nofollow">TechnionRepo</a></p>
1,256
text classification
Mutual Information for feature selection text classification
https://stackoverflow.com/questions/24845873/mutual-information-for-feature-selection-text-classification
<p>I use Naive Bayesian classifier for text classification. How can I make improvements of the accuracy of the algorithm using Mutual information measure for feature selection?</p>
<p>there are 2 improvements that you can use in text classification . First , you improve using the preprocessing techniques that you use such as N-Gram. Second, you can use feature selection techniques such as TF-IDF, Mutual Information, Chi-Square, and use other optimizations algorithm such as Genetic Algorithm, Bat ...
1,257
text classification
Multilabel Text Classification using Hugging Face Models for TensorFlow
https://stackoverflow.com/questions/75827730/multilabel-text-classification-using-hugging-face-models-for-tensorflow
<p>Trying to understand example of use Hugging Face Model for Multilabel Text Classification using Tenroflow from <a href="https://www.daniweb.com/programming/computer-science/tutorials/539042/multilabel-text-classification-using-hugging-face-models-for-tensorflow" rel="nofollow noreferrer">https://www.daniweb.com/pro...
1,258
text classification
Saving Word2Vec for CNN Text Classification
https://stackoverflow.com/questions/38555148/saving-word2vec-for-cnn-text-classification
<p>I want to train my own Word2Vec model for my text corpus. I can get the code from TensorFlow's tutorial. What I don't know is how to save this model to use for CNN text classification later? Should I use pickle to save it and then read it later?</p>
<p>No pickling is not the way of saving the model in case of tensorflow.</p> <p>Tensorflow provides with tensorflow serving for saving the models as proto bufs(for exporting the model). The way to save model would be to save the tensorflow session as: <strong>saver.save(sess, 'my_test_model',global_step=...
1,259
text classification
Text classification algorithms which are not Naive?
https://stackoverflow.com/questions/41243531/text-classification-algorithms-which-are-not-naive
<p>Naive Bayes Algorithm assumes independence among features. What are some text classification algorithms which are not <strong>Naive</strong> i.e. do not assume independence among it's features.</p>
<p>The answer will be very straight forward, since nearly <strong>every</strong> classifier (besides <strong>Naive</strong> Bayes) is not naive. Features independence is very rare assumption, and is not taken by (among huge list of others):</p> <ul> <li>logistic regression (in NLP community known as maximum entropy mo...
1,260
text classification
Text classification with Scikit-learn
https://stackoverflow.com/questions/35246498/text-classification-with-scikit-learn
<p>I am doing text classification for two labels with scikit learn .. I am loading my text files with the method load_files</p> <pre><code>categories={'label0','label1'} text_data = load_files(path,categories=categories) </code></pre> <p>from the following structure:</p> <pre><code>train ├── Label0 │ ├── 0001.txt ...
<p>The problem is after calling load_files, it is not yet a numpy array. It is just a list of text. You should vectorize this text using <code>CountVectorizer</code> or <code>TfidfVectorizer</code>.</p> <p><strong>Example:</strong></p> <pre><code>cv = CountVectorizer() X = cv.fit_transform(text_data.data) y = text_da...
1,261
text classification
How to change this RNN text classification code to text generation?
https://stackoverflow.com/questions/58055095/how-to-change-this-rnn-text-classification-code-to-text-generation
<p>I have this code to do text classification with TensorFlow RNN, but how to change it to do text generation instead?</p> <p>The following text classification has 3D input, but 2D output. Should it be changed to 3D input and 3D output for text generation? and how?</p> <p>The example data are:</p> <pre><code>t0 ...
<p>I found out how to switch it (the code) to do text generation task, use 3D input (X) and 3D labels (Y) as in the source code below:</p> <p>Source code:</p> <pre><code>import tensorflow as tf; tf.reset_default_graph(); #data ''' t0 t1 t2 british gray is cat 0 1 2 (3) &lt;=x 1 ...
1,262
text classification
text classification using keras input dimensions
https://stackoverflow.com/questions/59741936/text-classification-using-keras-input-dimensions
<p>I used to do text classification on sklearn. However, I have to do it using keras, so I followed this tutrial to encode the labels and so on as I have little experience with NN: <a href="https://www.opencodez.com/python/text-classification-using-keras.htm" rel="nofollow noreferrer">https://www.opencodez.com/python/t...
1,263
text classification
Is text classification fast enough for type ahead search?
https://stackoverflow.com/questions/58071233/is-text-classification-fast-enough-for-type-ahead-search
<p>I'm working on designing a typeahead service that can be used to search for many different things. I was thinking about creating a text classification model to categorize these searches before actually making the search. </p> <p>Here's an example of the result I'd want from the classification model.</p> <p>Input</...
<p>Usually in modern serving framework (like <a href="https://github.com/tensorflow/serving" rel="nofollow noreferrer">tensorflow serving</a> running on a standalone server), a standard text classification model based on shallow neural networks should have a latency under 1ms). You can look for a model composed by:</p>...
1,264
text classification
Feature Selection and Reduction for Text Classification
https://stackoverflow.com/questions/13603882/feature-selection-and-reduction-for-text-classification
<p>I am currently working on a project, a <strong>simple sentiment analyzer</strong> such that there will be <strong>2 and 3 classes</strong> in <strong>separate cases</strong>. I am using a <strong>corpus</strong> that is pretty <strong>rich</strong> in the means of <strong>unique words</strong> (around 200.000). I us...
<p>This is probably a bit late to the table, but...</p> <p>As Bee points out and you are already aware, the use of SVM as a classifier is wasted if you have already lost the information in the stages prior to classification. However, the process of text classification requires much more that just a couple of stages an...
1,265
text classification
SMOTE, Oversampling on text classification in Python
https://stackoverflow.com/questions/50999596/smote-oversampling-on-text-classification-in-python
<p>I am doing a text classification and I have very imbalanced data like </p> <pre><code>Category | Total Records Cate1 | 950 Cate2 | 40 Cate3 | 10 </code></pre> <p>Now I want to over sample Cate2 and Cate3 so it at least have 400-500 records, I prefer to use SMOTE over random sampling, Code </p> <pre><co...
<p>I know this question is over 2 years old and I hope you found a resolution. If in case you are still interested, this could be easily done with imblearn pipelines.</p> <p>I will proceed under the assumption that you will use a sklearn compatible estimator to perform the classification. Let's say Multinomial Naive Ba...
1,266
text classification
Does TPOT support multi-label text classification?
https://stackoverflow.com/questions/64034340/does-tpot-support-multi-label-text-classification
<p>How can I run TPOT to give me suggestions on what algorithm to use for a multi-label text classification? My data is already cleaned and divided into training and testing sets.</p>
<p>Yes, you can use TPOT for multi-label text classification.</p>
1,267
text classification
Grouped Text classification
https://stackoverflow.com/questions/57254603/grouped-text-classification
<p>I have thousands groups of paragraphs and I need to classify these paragraphs. The problem is that I need to classify each paragraph based on other paragraphs in the group! For example, a paragraph individually maybe belongs to class A but according to other paragraph in the group it belongs to class B.</p> <p>I ha...
1,268
text classification
R naive Bayes text classification issues
https://stackoverflow.com/questions/34242828/r-naive-bayes-text-classification-issues
<p>We are using R naive Bayes for text classification. Results are different from hand calculated. Maybe R is performing some normalization, distribution and does not work in multinominal mode (text words with frequency). Also I am unable to understand how does R naive byes computer prior conditional probability [,1] [...
1,269
text classification
convolutional neural network (CNN) for text classification
https://stackoverflow.com/questions/51646074/convolutional-neural-network-cnn-for-text-classification
<p>I am using CNN for text classification, in my model after flatten layer I used output layer directly without using dense layer. is that correct or must use dense layer? </p> <p>just as example:</p> <pre><code>model.add(Conv1D(filters=100, kernel_size=2,,padding='same' ,activation='relu')) model.add(MaxPooling1D(po...
<p>Generally, you do not have to use a Dense layer. As the outputs of your convolution do contain some spatial information, though, it might make sense to use one.</p> <p>I am assuming that you already understood how a convolution works. In that case, imagine what the activations at a certain position in the sentence ...
1,270
text classification
NLP text classification (flair)
https://stackoverflow.com/questions/73153511/nlp-text-classification-flair
<p>So I have basic question which I did not get answered by reading the documentation.</p> <ol> <li><p>If I want to do text classification (sentiment) about lets say an Articel with a topic. I already have the plain text without the html stuff through python libraries. Is it better to make an analysis about each sente...
1,271
text classification
Tool for text classification
https://stackoverflow.com/questions/5607880/tool-for-text-classification
<p>I am interested in learning about text classification so is reading up on the theory. Next step is doing stuff and therefore I am looking for and at different tools. Some links point to <a href="http://www.cs.waikato.ac.nz/ml/weka/" rel="nofollow">WEKA</a>, however <a href="http://mallet.cs.umass.edu/index.php" rel=...
<p>It depends on the task you are performing. Mallet is also a popularly used tool and both Weka and Mallet have their pros and cons. For trivial tasks, both are easy to use. I generaly prefer Weka for clustering and classification tasks.</p> <p>Note: Do not be misled by popularity of Weka on forum posts, it is primar...
1,272
text classification
How to find Information gain in text classification?
https://stackoverflow.com/questions/20720130/how-to-find-information-gain-in-text-classification
<p>I am working on text classification using Decision Tree which uses information gain as the main value for categorisation of text document. I have extracted few features by TF*IDF value. But I not able to figure out how exactly information gain should be calculated? There are some articles suggesting about this but n...
<p>you can use <strong>weka</strong> for calculating <strong>information gain</strong> . in weka <code>InfoGainAttributeEval.java</code> class will calculate IG for the word with respect to document.<a href="https://stackoverflow.com/questions/21063206/information-gain-calculation-for-a-text-file">check this answer</a>...
1,273
text classification
sparse gradient in text classification with pytorch
https://stackoverflow.com/questions/76243788/sparse-gradient-in-text-classification-with-pytorch
<p>I am trying to train a text classification module.</p> <p>When I use <code>Adam</code>, <code>RAdam</code>, or <code>RMSProp</code> for my optimizer, I get the following error:</p> <pre><code>RuntimeError: Adam/RAdam/RMSProp does not support sparse gradients </code></pre> <p>So I tried using <code>SparseAdam</code> ...
1,274
text classification
Machine Learning Text Classification technique
https://stackoverflow.com/questions/27002483/machine-learning-text-classification-technique
<p>I have large number(say 3000)key words.These need to be classified into seven fixed categories.Each category is having training data(sample keywords).I need to come with a algorithm, when a new keyword is passed to that,it should predict to which category this key word belongs to.</p> <p>I am not aware of which text...
<p>This comes under linear classification. You can use naive-bayes classifier for this. Most of the ml frameworks will have an implementation for naive-bayes. ex: mahout</p>
1,275
text classification
predict text classification using python
https://stackoverflow.com/questions/40880637/predict-text-classification-using-python
<p>I want to predict a text classification which is based on the correlation of the text in the training data set.</p> <p>For eg. This is my training data: "Mouse M325", "Mouse for xyz M325", "M325 Mouse logitech", "Logitech mouse number M325"</p> <p>As it is visible that Mouse and M325 definitely have a high correla...
1,276
text classification
Word2vec with Conv1D for text classification confusion
https://stackoverflow.com/questions/49048758/word2vec-with-conv1d-for-text-classification-confusion
<p>I am doing text classification and plan to use word2vec word embeddings and pass it to Conv1D layers for text classification. I have a <a href="https://www.dropbox.com/s/bxe63rkqkaqji1x/emotion_merged_dataset.csv?dl=0" rel="nofollow noreferrer">dataframe</a> which contains the texts and corresponding labels(sentimen...
<p>Sorry for the late response, I hope it is still useful for you. Depending on your application you may need to download a specific wordembedding file, for example here yoou have the <a href="https://nlp.stanford.edu/projects/glove/" rel="nofollow noreferrer">Glove files</a> </p> <pre><code>EMBEDDING_FILE='glove.6B.5...
1,277
text classification
Text Classification into Categories
https://stackoverflow.com/questions/8136677/text-classification-into-categories
<p>I am working on a text classification problem, I am trying to classify a collection of words into category, yes there are plenty of libraries available for classification, so please dont answer if you are suggesting to use them.</p> <p>Let me explain what I want to implement. ( take for example )</p> <p>List of Wo...
<p>Of course this can be implemented. If you train a Naive Bayes classifier or linear SVM on the right dataset (titles of Java and C# programming books, I guess), it should learn to associate the term "Java" with Java, "C#" and ".NET" with C#, and "programming" with both. I.e., a Naive Bayes classifier would likely lea...
1,278
text classification
Dictionary Based Text CLassification in Python
https://stackoverflow.com/questions/73701800/dictionary-based-text-classification-in-python
<p>It's quite a while now that I'm looking for a descent <strong>dictionary based text classification</strong> library in Python.</p> <p>My use case is as follow: I will be receiving a long <strong><code>text</code></strong> which would likely talk about several things and hopefully mention some of a pre-defined <stron...
<p>You're asking for a simple solution while at the same time asserting that the problem is complex and that the frequency of related tokens may not be a strong enough indicator to always predict the right class. What you're alluding to is that you need to understand the context in which your related tokens are mention...
1,279
text classification
text classification based on TF-IDF and CNN
https://stackoverflow.com/questions/77861333/text-classification-based-on-tf-idf-and-cnn
<p>I'm doing binary text classification. I used TF-IDF weighting to build the CNN model, but I got results that weren't as expected.</p> <pre><code>train_df = pd.read_csv(&quot;merged_data.csv&quot;, encoding='utf-8') x = train_df['Text'].values y = train_df['Label'].values x_train, x_test, y_train, y_test = train_t...
1,280
text classification
Classification with Weka+ NaiveBayes Classifier+ Text classification
https://stackoverflow.com/questions/9557650/classification-with-weka-naivebayes-classifier-text-classification
<p>I'm using Weka for text classification task. I created my data.arff File. It contains two attributes:</p> <ol> <li>text attribute</li> <li>class attribute</li> </ol> <p>Then, the generated ARFF file is processed with the StringToWordVector:</p> <blockquote> <p>java weka.filters.unsupervised.attribute.StringToWo...
<p>It's exactly what it says - it cannot handle numeric values for the class variable. If you declared the class variable to be string, change the numeric values to their equivalent text values.</p>
1,281
text classification
Apache Spark Naive Bayes based Text Classification
https://stackoverflow.com/questions/24011418/apache-spark-naive-bayes-based-text-classification
<p>im trying to use Apache Spark for document classification.</p> <p>For example i have two types of Class (C and J)</p> <p>Train data is :</p> <pre><code>C, Chinese Beijing Chinese C, Chinese Chinese Shanghai C, Chinese Macao J, Tokyo Japan Chinese </code></pre> <p>And test data is : Chinese Chinese Chinese Tokyo ...
<p>Yes, it doesn't look like there is any simple tool to do that in Spark yet. But you can do it manually by first creating a dictionary of terms. Then compute IDFs for each term and then convert each documents into vectors using the TF-IDF scores.</p> <p>There is a post on <a href="http://chimpler.wordpress.com/2014/...
1,282
text classification
Text Classification : LSTM vs Feedforward
https://stackoverflow.com/questions/61073198/text-classification-lstm-vs-feedforward
<p>I am training a text classification model. </p> <p><strong>Task</strong> : Given a description, identify the quantifier </p> <p><strong>For ex</strong> 1) This field contains the total revenue amount in USD -> amount </p> <p>2) This has city code -> code</p> <p>3) total deposit amount is 34 -> amount </p> <p>4...
<p>I can't say exactly why, but my guess is sample size/data quality. The deeper learning, the more data it needs and the more sensitive it is to small biases in the training data. If you have a small dataset, it might be possible that a less complex model will serve better. <a href="https://i.sstatic.net/Gicfb.png" re...
1,283
text classification
Text Classification of News Articles Using Spacy
https://stackoverflow.com/questions/62278996/text-classification-of-news-articles-using-spacy
<p><strong>Dataset</strong> : Csv files containing around <strong>1500</strong> data with columns <strong>(Text,Labels)</strong> where Text is the news article of <strong>Nepali Language</strong> and Label is its genre(Health, World,Tourism, Weather) and so on.</p> <p>I am using <a href="https://spacy.io/usage/trainin...
<p>You have to add your own labels. So, in your case:</p> <pre><code>textcat.add_label('Health') textcat.add_label('World') textcat.add_label('Tourism') ... </code></pre> <p><code>spacy</code> then will be able to predict only those categories, that you added in the above block of code</p> <p>There is a special form...
1,284
text classification
Text classification: Raw dictionary input and text vectorization
https://stackoverflow.com/questions/56426352/text-classification-raw-dictionary-input-and-text-vectorization
<p>I am working with some text processing using a series of sklearn classifiers. In an <a href="http://blog.chapagain.com.np/machine-learning-sentiment-analysis-text-classification-using-python-nltk/" rel="nofollow noreferrer">example</a> I found on the internet, I have noticed that the input of the classifier is a ser...
<p>According to the <a href="https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.HashingVectorizer.html" rel="nofollow noreferrer">documentation</a>, it tokenizes the text it gets (you can customize the how to tokenize the text, a regex telling what you consider a word and list of stopword...
1,285
text classification
Attention based recurrent neural network for text classification
https://stackoverflow.com/questions/42905106/attention-based-recurrent-neural-network-for-text-classification
<p>Are there any implementations of Attention-based RNN for text classification? (in theano, Karas,....)? I found some implementations of this model but they are used more often for the text generation purposes.</p>
<p>You can combine the information from:</p> <p><a href="https://github.com/Microsoft/CNTK/wiki/Implement-an-attention-mechanism" rel="nofollow noreferrer">https://github.com/Microsoft/CNTK/wiki/Implement-an-attention-mechanism</a></p> <p>and apply to a token classification model explained here:</p> <p><a href="http...
1,286
text classification
How can I use BERT for long text classification?
https://stackoverflow.com/questions/58636587/how-can-i-use-bert-for-long-text-classification
<p>We know that BERT has a maximum length limit of tokens = 512. So if an article has a length of much bigger than 512, such as 10000 tokens in text, how can BERT be used?</p>
<p>You basically have three options:</p> <ol> <li>You can cut the longer texts off and only use the first 512 tokens. The original BERT implementation (and probably the others as well) truncates longer sequences automatically. For most cases, this option is sufficient.</li> <li>You can split your text in multiple subte...
1,287
text classification
dataset import error for AutoML text classification
https://stackoverflow.com/questions/52319164/dataset-import-error-for-automl-text-classification
<p>I have trying to import dataset into AutoML NL Text Classification. However, the Ui gave me an error of Invalid row in CSV file , Error details: Error detected: "FILE_TYPE_NOT_SUPPORTED"</p> <p>I am uploading the csv file, what should I do?</p>
<p>Please make sure there is no hidden quotes in your dataset. Complete requirements can be found on “<a href="https://cloud.google.com/natural-language/automl/docs/prepare" rel="nofollow noreferrer">Preparing your training data</a>” page.</p> <blockquote> <p>Common .csv errors:</p> <ul> <li>Using Unicode cha...
1,288
text classification
Text Classification Problem : Name and approach of this type of classification
https://stackoverflow.com/questions/59227070/text-classification-problem-name-and-approach-of-this-type-of-classification
<p>I have a labelled data-set comprising of text segments and corresponding labels. Each label consists of three parts, and there can be multiple or zero labels assigned to a given text segment. </p> <pre><code>Sample Data is given below: text segment action performed person ...
<p>This is not a classification problem. Although you could perhaps torture a classification model for this purpose, the NLP technique you need is "dependency parsing" and "semantic role labeling". Spacy is a good python library for doing dependency parsing.</p>
1,289
text classification
Text classification for logistic regression with pipelines
https://stackoverflow.com/questions/53468055/text-classification-for-logistic-regression-with-pipelines
<p>I am trying to use <code>LogisticRegression</code> for text classification. I am using <code>FeatureUnion</code> for the features of the <code>DataFrame</code> and then <code>cross_val_score</code> to test the accuracy of the classifier. However, I don't know how to include the feature with the free text, called <co...
<pre><code>pipeline = Pipeline([ ('vect', CountVectorizer(stop_words='english',lowercase=True)), (&quot;tfidf1&quot;, TfidfTransformer(use_idf=True,smooth_idf=True)), ('clf', MultinomialNB(alpha=1)) #Laplace smoothing ]) train,test=train_test_split(df,test_size=.3,random_state=42, shuffle=True) pipeline.fit(train['...
1,290
text classification
SVM for text classification - tutorial on machine learning? How do I get started?
https://stackoverflow.com/questions/20772876/svm-for-text-classification-tutorial-on-machine-learning-how-do-i-get-started
<p>I'm looking for a really good tutorial on machine learning for text classification perhaps using Support vector machine (SVM) or other appropriate technology for large-scale supervised text classification. If there isn't a great tutorial, can anyone give me pointers to how a beginner should get started and do a good...
<p>In its classical flavour the Support Vector Machine (SVM) is a binary classifier (i.e., it solves classification problems involving two classes). However, it can be also used to solve multi-class classification problems by applying techniques likes One versus One, One Versus All or Error Correcting Output Codes <a h...
1,291
text classification
Text Classification - Multiple Training Datasets
https://stackoverflow.com/questions/70750444/text-classification-multiple-training-datasets
<p>Would there be “dilution” of accuracy if I train the same text classification model with multiple training datasets? For example, my end users would be providing (uploading) their own tagged CSVs to train the model and use the trained model in the future. The contexts of datasets would be different - L&amp;D, Techno...
<p>I ended up using huggingface's zero-shot classification.</p>
1,292
text classification
Text Classification - using stemmer degrades results?
https://stackoverflow.com/questions/21294694/text-classification-using-stemmer-degrades-results
<p>There's <a href="http://www.cs.indiana.edu/~mkorayem/paper/survey_Arabic.pdf" rel="nofollow">this</a> article about sentiment analysis of Arabic. </p> <p>In the beginning of page 5 it says that:</p> <blockquote> <p>"Experiments also show that stemming words before feature extraction and classification nearly alw...
<p>I do not know the arabic language, it may be specific in many aspects, my answer regards english.</p> <blockquote> <p>Um I thought that a stemmer/lemmatizer was always used before text classifications, why does he say that it degrades the results?</p> </blockquote> <p>No it is not, in entirely depends on the <st...
1,293
text classification
Multi-class text classification where classification depends on other columns beside text column
https://stackoverflow.com/questions/77015193/multi-class-text-classification-where-classification-depends-on-other-columns-be
<p>I want to do text classification in Python where I have a df with 3 columns: scenario, text and label. The label depends on the column text but also on the column scenario. There are 6 different scenarios.</p> <p>Would it be correct to make a new column where I would merge columns scenario and text into one string a...
<p>That depends on how you would be merging the two. Simply concatenating might not be the best idea. It might be good to introduce a special token between the two strings, like the [SEP] (or any other token) during the training and the inference so that it becomes easier for the model to understand the pattern.</p> <p...
1,294
text classification
Plot decision boundary for text classification
https://stackoverflow.com/questions/40639316/plot-decision-boundary-for-text-classification
<p>I am looking for examples that show how to plot decision boundaries for text classification. I know about some of the examples in the sklearn documentation, but how do I apply them to text data?</p> <p>I am not even sure, what to plot. Can a decision boundary be plotted for this?</p> <p>I was thinking of using the...
<p>The difficulty here is that text classification is a high-dimensional problem, where the dimensionality equals the size of the vocabulary. Plotting this in 2d would require the application of a dimensionality reduction technique first, e.g, pca or t-sne and then training the learning algorithm on this new representa...
1,295
text classification
Text Classification in spacy v3
https://stackoverflow.com/questions/72256559/text-classification-in-spacy-v3
<p>I am trying to perform a text classification using spacy v3.</p> <p>I am a bit confused with CLI approach. However, following the examples in the spacy project repo <a href="https://github.com/explosion/projects/tree/v3/tutorials" rel="nofollow noreferrer">HERE</a>.</p> <p>I downloaded test data right <a href="https...
1,296
text classification
Combine different types of features (Text classification)
https://stackoverflow.com/questions/41419780/combine-different-types-of-features-text-classification
<p>I'm doing text classification task I faced a problem. I've already selected the 1000 best feature collection using bag-of-words approach. Now I want use another features based on Part-of-Speech, average word length etc. After I want to combine these features together. How can I achieve it I'm using Python, NLTK, S...
<p>There is nothing wrong with combining features of different types (in fact it's generally a good idea for classification tasks). The NLTK's API expects features to come in a dictionary, so you just need to combine your feature collections into a single dictionary.</p> <p>This is the answer to the question you asked...
1,297
text classification
TensorflowJS text/string classification
https://stackoverflow.com/questions/51698131/tensorflowjs-text-string-classification
<h2>Subject</h2> <p>Hello. I wanna implement text classification feature using <strong>Tensorflow.js in <code>NodeJS</code></strong>. <br/> Its job will be to match a string with some pre-defined topics.</p> <h2>Examples:</h2> <p><strong>Input</strong>: <em><code>String</code></em>: "My dog loves walking on the beac...
<p>Text classification has an added challenge which is to first find the vectors from words. There are various approaches depending on the nature of the problem solved. Before building the model, one might ensure to have the vectors associated to all the words of the corpus. After the representation of a vector from th...
1,298
text classification
Text classification and most informative features
https://stackoverflow.com/questions/73539045/text-classification-and-most-informative-features
<p>I'm trying to do some text classification and understand which are the most informative feature the model uses.</p> <p>I get the Accuracy of the model but when it comes to understand the feature_names it's shows and empty row '' (accuracy: 0.38405797101449274 Top 10 features used to predict: Class 1 best: (0.0068635...
1,299
machine translation
Neural Machine Translation
https://stackoverflow.com/questions/74148090/neural-machine-translation
<p>I am doing a project about Neural Machine Translation. In the data processing step, is it necessary to padding after the sentences so that they are of equal length?</p>
1,300
machine translation
Vocabulary scale of machine translation
https://stackoverflow.com/questions/64906445/vocabulary-scale-of-machine-translation
<p>When doing machine translation, if you segment words, such as using BPE, how big is the processed vocabulary?</p>
<p>The BPE algorithm starts with a list of characters in the data and iteratively merges the most frequent symbol pairs. If the algorithm would not have a stopping criterion, you would end up with a vocabulary that covers all words from your training data + all characters + all merges in between the characters and the ...
1,301
machine translation
Google Translator Toolkit machine-translation issues
https://stackoverflow.com/questions/33403481/google-translator-toolkit-machine-translation-issues
<p>I am using python 2.7 &amp; django 1.7.</p> <p>When I use <a href="https://translate.google.com/toolkit/" rel="nofollow">Google Translator Toolkit</a> to machine translate my .po files to another language (English to German), there are many errors due to the use of different django template variables in my translat...
<blockquote> <p>The %(site_name_lowercase)s is machine translated to % (site_name_lowercase) s and is often concatenated to the precedding word, as shown above.</p> </blockquote> <p>This is caused by tokenization prior to translation, followed by detokenization after translation, i.e. Google Translate tries to split...
1,302
machine translation
Collecting data for machine translation
https://stackoverflow.com/questions/64023394/collecting-data-for-machine-translation
<p>I am interested in trying to make a machine translation for language accents and is curious for methods avaialable to collect data or how to make your own corpus with unlimited resource. Any good reference i could refer to or ideas?</p>
<p>There are lots of open corpora you may wish to look at, many of which are collated here on the <a href="http://opus.nlpl.eu/" rel="nofollow noreferrer">The Open Parallel Corpus (OPUS)</a>, to seed some data for your exercise.</p> <p>In terms of building and collecting your own, you could consider <a href="https://ww...
1,303
machine translation
Open Source Machine Translation Engines?
https://stackoverflow.com/questions/11302342/open-source-machine-translation-engines
<p>We're looking for an open source Machine Translation Engine that could be incorporated into our localization workflow. We're looking at the options below:</p> <ol> <li><a href="http://www.statmt.org/moses/">Moses</a> (C++)</li> <li><a href="http://www.computing.dcu.ie/~mforcada/fosmt.html">Joshua</a> (Java)</li> <l...
<p>This question is better asked on the Moses mailing list (moses-support@mit.edu), I think. There are lots of people there working with different types of systems, so you'll get an objective answer. Apart from that, here's my input:</p> <ul> <li>With respect to Java: it does not matter in which language the MT system...
1,304
machine translation
Tensorflow - Decoder for Machine Translation
https://stackoverflow.com/questions/66205290/tensorflow-decoder-for-machine-translation
<p>I am going through <a href="https://www.tensorflow.org/tutorials/text/nmt_with_attention#training" rel="nofollow noreferrer">Tensorflow's tutorial</a> on Neural Machine Translation using Attention mechanism.</p> <p>It has the following code for the Decoder :</p> <pre><code>class Decoder(tf.keras.Model): def __init...
<p>This is very well summarized by this <a href="https://github.com/tensorflow/nmt" rel="nofollow noreferrer">detailed NMT guide</a>, which compares the classic seq2seq NMT against the encoder-decoder attention-based NMT architectures.</p> <blockquote> <p><strong>Vanilla seq2seq:</strong> The decoder also needs to have...
1,305
machine translation
Dialogflow language coverage and Google Neural Machine Translation
https://stackoverflow.com/questions/47414003/dialogflow-language-coverage-and-google-neural-machine-translation
<p>Google started “Google Neural Machine Translation” system in 2016 and improved the efficiency of translation of some languages tremendously. These languages include German, French, Spanish, Portuguese, Chinese, Japanese, Turkish and Korean; as they said.</p> <p>However Dialogflow supports all of these languages exc...
<p>Dialogflow does not handle translation, so Google's work in this area doesn't apply. </p> <p>What Dialogflow <em>does</em> do that is language related is let you create sample phrases, in that language, and can handle other, similar, phrases that a user might make in conversation. So it isn't about translating a la...
1,306
machine translation
How to fine-tune a Mistral-7B model for machine translation?
https://stackoverflow.com/questions/78156752/how-to-fine-tune-a-mistral-7b-model-for-machine-translation
<p>There's a lot of tutorials online that uses raw text affix with arcane syntax to indicate document boundary and accessed through Huggingface <code>datasets.Dataset</code> object through the <code>text</code> key. E.g.</p> <pre><code>from datasets import load_dataset dataset_name = &quot;mlabonne/guanaco-llama2-1k&q...
<p>The key is to re-format the data from a traditional machine translation dataset that splits the source and target text and piece them up together in a format that the model expects.</p> <p>For the Mistral 7B model specifically, it usually expects:</p> <ul> <li>each row of data would be encapsulated between <code>&lt...
1,307
machine translation
Phrase extraction algorithm for statistical machine translation
https://stackoverflow.com/questions/25109001/phrase-extraction-algorithm-for-statistical-machine-translation
<p>I have written the following code with the phrase extraction algorithm for SMT.</p> <p><a href="https://github.com/alvations/nltk/blob/develop/nltk/align/phrase_based.py" rel="noreferrer">GitHub</a></p> <pre><code># -*- coding: utf-8 -*- def phrase_extraction(srctext, trgtext, alignment): """ Phrase extra...
<p>So I have had a look at this problem and can now reproduce the desired output. Turns out there are a number of problems:</p> <ul> <li>The algorithm is not quite complete. In the online version of the book (3rd printing 2012) line 4 of the extract function has been updated. (Maybe there is an Errata)</li> <li>The...
1,308
machine translation
Sentence Indicating in Neural Machine Translation Tasks
https://stackoverflow.com/questions/66294861/sentence-indicating-in-neural-machine-translation-tasks
<p>I have seen many people working on Neural Machine Translation. Usually, they represent their sentence between <code>&lt;BOS&gt;&lt;EOS&gt;</code>, <code>&lt;START&gt;&lt;END&gt;</code>, etc. tags, before training the network. Of course it's a logical solution to specify the start and end of sentences, but I wonder h...
<p>It doesn't.</p> <p>At inference time, there's a hardcoded rule that if that token is generated, the sequence is done, and the underlying neural model will no longer be asked for the next token.</p> <pre><code>source_seq = tokenize('This is not a test.') print(source_seq) </code></pre> <p>At this point you'd get some...
1,309
machine translation
Watson Machine Translation in Node Red Flow
https://stackoverflow.com/questions/31006912/watson-machine-translation-in-node-red-flow
<p>It seems there have been some changes in the usage of the Machine Translation service from within a Node Red flow. There was the capability to configure from within the node from which into which other language to translate. This has been changed. Can you help me in understanding where to set exactly this when havin...
<p>There are two ways to set the translation language for the Machine Translation node. </p> <p>You can either...</p> <ul> <li>Select the language from the dropdown menu in the node configuration dialog. </li> </ul> <p><img src="https://i.sstatic.net/ozq8N.png" alt="node configuration"></p> <ul> <li>Pass the langua...
1,310
machine translation
How to use basic BLEU score in Asiya Machine Translation Evaluation toolkit?
https://stackoverflow.com/questions/30011056/how-to-use-basic-bleu-score-in-asiya-machine-translation-evaluation-toolkit
<p>Asiya is the machine translation evaluation toolkit to score machine translation outputs (<a href="http://asiya.lsi.upc.edu/" rel="nofollow">http://asiya.lsi.upc.edu/</a>). It is largely written in Perl.</p> <p><strong>How do I use Asiya to perform BLEU metrics?</strong></p> <p>I have followed the youtube introduc...
1,311
machine translation
Using existing human translations to aid machine translation to a new language
https://stackoverflow.com/questions/26308109/using-existing-human-translations-to-aid-machine-translation-to-a-new-language
<p>In the past, my company has used human, professional translators to translate our software from English into some 13 languages. It's expensive but the quality is high.</p> <p>The application we're translating contains industry jargon. It also contains a lot of sentence fragments and single words which, out of conte...
<p>Yes. A lot has changed in the decade since 2014.</p> <p>Now, as of 2023, there are more than a dozen customizable cloud API providers, many of them self-serve.</p> <p>For example, Google Translate launched customization in 2018, after launching <a href="https://machinetranslate.org/neural-machine-translation" rel="...
1,312
machine translation
How to find out the quality of machine translation systems?
https://stackoverflow.com/questions/58624033/how-to-find-out-the-quality-of-machine-translation-systems
<p>I know that there are various metrics for measuring the quality of machine translation systems, for example:</p> <ul> <li>Bleu</li> <li>METEOR</li> <li>Lepor</li> </ul> <p>Are there somewhere in the public domain metric results for popular translation systems? For example, such as:</p> <ul> <li>Google translate</li>...
<p>Machine translation quality is annually evaluated at the <a href="http://www.statmt.org/wmt19/" rel="nofollow noreferrer">Conference on Machine Translation</a>. Most of the evaluated systems are experimental systems from universities, but most of the systems you mention participate as well. You the results of last y...
1,313
machine translation
English query generation through machine translation systems
https://stackoverflow.com/questions/11122473/english-query-generation-through-machine-translation-systems
<p>I'm working on a project to generate questions from sentences. Right now, I'm at a point where I can generate questions like: "Angela Merkel is the chancelor of Germany." -> "Angela Merkel is who?"</p> <p>Now, of course, I want the questions to look like "Who is...?" instead. Is there any easy way to do this that I...
<p>Check out Michael Heilman's dissertation <a href="http://www.ark.cs.cmu.edu/mheilman/questions/papers/heilman-question-generation-dissertation.pdf" rel="nofollow">Automatic Factual Question Generation from Text</a> for background on question generation and to see what his approach to this problem looks like. You ca...
1,314
machine translation
Cleaning text data for Neural Machine translation
https://stackoverflow.com/questions/65170091/cleaning-text-data-for-neural-machine-translation
<p>I am cleaning my data to get pairs of text for converting from language X to Y for machine translation</p> <pre><code> [['\ufeffMensahe di Pasco di Gobernador di Aruba 2019', 'Governor’s Christmas speech 2019'], ['Gobernador di Aruba Sr. Alfonso Boekhoudt a duna su mensahe di Pasco riba 24 december ultimo', ...
<p>Your structure is a list of lists. In Python you index them like this:</p> <pre><code>clean[i][0] # not like clean[i,0] </code></pre>
1,315
machine translation
What is role of parser(POS, TAG, Dependecency) in machine translation?
https://stackoverflow.com/questions/54757820/what-is-role-of-parserpos-tag-dependecency-in-machine-translation
<p>I would like to know what is the main purpose of parsing a sentence for example we get all the POS-tag of the sentence in training machine translation? I thought we just need to tokenize the sentence and then feed it into neural network to train? What is the purpose of having the POS tag and how can it be implemente...
<p>If you have a only tokenized word by splitting sentence, you get only dictionary by word.</p> <p>For example, you have two sentences , [I love coffee], [I like milk].</p> <p>Dictionary might be [I], [love], [coffee], [like], [milk] called bag-of-word consisted of 5 dimension.</p> <p>Imagine you make your language...
1,316
machine translation
How to handle names/unknown words in neural machine translation?
https://stackoverflow.com/questions/55281727/how-to-handle-names-unknown-words-in-neural-machine-translation
<p>Can anyone explain a best method to handle unknown words in <strong>Neural machine translation</strong> instead of removing it and to know how google translate is handling names while the sentence is getting translate between any two languages ?</p> <p>I'd really appreciate your response...Thanks!</p>
<p>Current NMT models do not work with words in the traditional sense, but with so-called subwords. Segmentation of the text into subwords is done using statistical models which ensure that frequently used words or strings of characters remain together and less frequent words get split, ultimately they can split into i...
1,317
machine translation
Can mT5 model on Huggingface be used for machine translation?
https://stackoverflow.com/questions/76040850/can-mt5-model-on-huggingface-be-used-for-machine-translation
<p>The <code>mT5</code> model is pretrained on the mC4 corpus, covering 101 languages:</p> <blockquote> <p>Afrikaans, Albanian, Amharic, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bulgarian, Burmese, Catalan, Cebuano, Chichewa, Chinese, Corsican, Czech, Danish, Dutch, English, Esperanto, Estonian, Fili...
<h3>Can it do machine translation?</h3> <p>From the doc:</p> <blockquote> <p>Note: mT5 was only pre-trained on mC4 <strong>excluding any supervised training</strong>. Therefore, this model has to be fine-tuned before it is useable on a downstream task.</p> </blockquote> <p>therefore, no, it cannot do machine translatio...
1,318
machine translation
How to deal with punctuations in machine translation
https://stackoverflow.com/questions/46290238/how-to-deal-with-punctuations-in-machine-translation
<p>Just curious how people usually deal with punctuation in machine translation. </p> <p>For example, from language A to B we might have:</p> <pre><code>A: a b c d e f g B: x y z, u v w </code></pre> <p>I am wondering how do we deal with the comma in language B? Say if we 're using seq2seq model, shall we simply rem...
<p>A good application for Seq2Seq is machine translation. </p> <p>In the case of English->German, we will see German sentence that requires additional comma, e.g.</p> <blockquote> <p><strong>EN:</strong> I shot him because the colonel had told me so.</p> <p><strong>DE:</strong> Ich habe auf ihn geschossen, wei...
1,319
machine translation
Can we use Generative Adversarial Network for Neural Machine Translation?
https://stackoverflow.com/questions/59099391/can-we-use-generative-adversarial-network-for-neural-machine-translation
<p>I'm going to implement a translator based on NMT(Neural Machine Translation). In here I hope to use only monolingual corpora without using parallel corpus data for my dataset. Is it possible to train the model using only monolingual corpora data? I'm grateful if someone can share your idea regarding this.</p>
1,320
machine translation
Neural Machine Translation from Latex to English without sufficient training data
https://stackoverflow.com/questions/50199395/neural-machine-translation-from-latex-to-english-without-sufficient-training-dat
<p>I'm trying to build a Neural Machine Translation model that translates Latex-code into English. An example for this would be: "\frac{1^{n}}{12}" -> "One to the power of n divided by 12". The problem is that I don't have nearly enough labeled training data to produce a good result.</p> <p>Is there a way to train the...
1,321
machine translation
Do glossaries in Weblate have any effect on machine translations?
https://stackoverflow.com/questions/59957175/do-glossaries-in-weblate-have-any-effect-on-machine-translations
<p>In Weblate it is easy to add terms to glossaries. I was wondering if these glossaries might be "sent" to any of the machine translation services, to increase the quality of the machine translations. Or are they purely to help the human translators?</p>
<p>Currently, there is no such integration - so the glossaries are there purely to help humans.</p>
1,322
machine translation
There are deep learning methods for string similarity in machine translation?
https://stackoverflow.com/questions/50435118/there-are-deep-learning-methods-for-string-similarity-in-machine-translation
<p>I am interested in machine translation and more specific I would like to examine the similarity between two strings. I would like to know if there are deep learning methods for text feature extraction. I already tried the famous statistics methods like cosine similarity, Levenstein distance, word frequency and other...
<p>To find the similarity between 2 string ,try to train a <strong>Siamese networks</strong> on your dataset</p> <p><strong>Siamese networks</strong> are a special type of neural network architecture. Instead of a model learning to classify its inputs, the neural networks learns to differentiate between two inputs. It...
1,323
machine translation
What&#39;s a Good Machine Translation Metric or Gold Set
https://stackoverflow.com/questions/8510762/whats-a-good-machine-translation-metric-or-gold-set
<p>I'm starting up looking into doing some machine translation of search queries, and have been trying to think of different ways to rate my translation system between iterations and against other systems. The first thing that comes to mind is getting translations of a set of search terms from mturk from a bunch of peo...
<p>I'd suggest refining your question. There are a great many metrics for machine translation, and it depends on what you're trying to do. In your case, I believe the problem is simply stated as: "Given a set of queries in language L1, how can I measure the quality of the translations into L2, in a web search context...
1,324
machine translation
Loading huge text files for neural machine translation with Pytorch
https://stackoverflow.com/questions/49338649/loading-huge-text-files-for-neural-machine-translation-with-pytorch
<p>In PyTorch, I have written a dataset loading class for loading 2 text files as source and targets, for neural machine translation purpose. Each file has 93577946 lines, and each of them allocates 8GB memory on Hard Disc.</p> <p>The class is as the following:</p> <pre><code>class LoadUniModal(Dataset): sources ...
<p>This shouldn't give you an error unless you load the entire data in memory at once. One suggestion I want to give you is: don't pad all sentences to a maximum length. In machine translation data, in general, sentence lengths vary a lot.</p> <p>Also, you can try smaller mini-batches of size <code>x</code> (ex., 32, ...
1,325
machine translation
What are some examples of Machine Translation applications/libraries currently being developed?
https://stackoverflow.com/questions/4456181/what-are-some-examples-of-machine-translation-applications-libraries-currently-b
<p>I'm interested in learning more about Machine Translation. While I have some very interesting books on the matter, I'd like to see some real world applications of MT's theories.</p> <p>I've found a couple open source projects just by searching around:</p> <p><a href="http://www.apertium.org/">Apertium</a></p> <p...
<p><strong>Machine Translation Packages</strong></p> <p>Besides <a href="http://www.statmt.org/moses/" rel="nofollow">Moses</a> and <a href="http://www.apertium.org/" rel="nofollow">Apertium</a>, other good open source tools for machine translation that are being actively developed/supported are:</p> <ul> <li><a href...
1,326
machine translation
What&#39;s a good explanation of statistical machine translation?
https://stackoverflow.com/questions/5815252/whats-a-good-explanation-of-statistical-machine-translation
<p>I'm trying to find a good high level explanation of how statistical machine translation works. That is, supposing I have a corpus of non-aligned English, French and German texts, how could I use that to translate any sentence from one language to another ? It's not that I'm looking to build a Google Translate mysel...
<p>Here is a nice video lecture (in 2 parts):</p> <p><a href="http://videolectures.net/aerfaiss08_koehn_pbfs/" rel="nofollow noreferrer">http://videolectures.net/aerfaiss08_koehn_pbfs/</a></p> <p>For in-depth details, I highly advise this book:</p> <p><a href="https://rads.stackoverflow.com/amzn/click/com/0521874157...
1,327
machine translation
How to find train_losses and val_losses in Tensorflow, Neural machine translation with attention
https://stackoverflow.com/questions/67282469/how-to-find-train-losses-and-val-losses-in-tensorflow-neural-machine-translatio
<p>I am learning Neural machine translation from this tutorial <a href="https://www.tensorflow.org/tutorials/text/nmt_with_attention#restore_the_latest_checkpoint_and_test" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/text/nmt_with_attention#restore_the_latest_checkpoint_and_test</a></p> <p>But seems ...
<p>In that tutorials, there have actually. When they use</p> <pre><code>for epoch in range(EPOCHS): start = time.time() enc_hidden = encoder.initialize_hidden_state() total_loss = 0 for (batch, (inp, targ)) in enumerate(dataset.take(steps_per_epoch)): batch_loss = train_step(inp, targ, enc_hidden) tot...
1,328
machine translation
How checkpoint.restore() works in Tensorflow, Neural machine translation with attention
https://stackoverflow.com/questions/67276646/how-checkpoint-restore-works-in-tensorflow-neural-machine-translation-with-at
<p>I am learning Neural machine translation from this tutorial <a href="https://www.tensorflow.org/tutorials/text/nmt_with_attention#restore_the_latest_checkpoint_and_test" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/text/nmt_with_attention#restore_the_latest_checkpoint_and_test</a></p> <p>But there ...
<p>Here, the <code>checkpoint</code> is an instance of <a href="https://www.tensorflow.org/api_docs/python/tf/train/Checkpoint" rel="nofollow noreferrer">tf.train.Checkpoint</a>. Somehow you have missed it, check <a href="https://www.tensorflow.org/tutorials/text/nmt_with_attention#checkpoints_object-based_saving" rel=...
1,329
machine translation
A language model for machine translation between a low-resource language and Portuguese using Tensorflow
https://stackoverflow.com/questions/78911175/a-language-model-for-machine-translation-between-a-low-resource-language-and-por
<p>I'm trying to train a language model for machine translation between a low-resource language and Portuguese using Tensorflow. unfortunately, I'm getting the following error:</p> <pre><code>PS C:\Users\myuser\PycharmProjects\teste&gt; python .\tensorflow_model.py 2024-08-23 21:29:50.839647: I tenso...
<p>The error indicates that you're attempting to create a dataset with two tensors (<code>src_tensor</code> and <code>tgt_tensor</code>), but they have different shapes (i.e, one could have 21 rows and the other could have 22 rows) which is making incompatible for creating a dataset. To resolve this issue, you need to...
1,330
machine translation
Naive rule-based machine translation
https://stackoverflow.com/questions/60342861/naive-rule-based-machine-translation
<p>In order to develop a translation system for a constructed language, I am looking for a method that is easy to implement. I turn quite naturally to algorithms based on rules encoded by an "expert".</p> <p>Thus, I am looking for references (codes, explanatory documents...) about naive translation algorithms; for exa...
<p>Looking and working with translations, use books and dictionary, and a leguaje as reference, by example from book Moby Dick:</p> <pre><code>"Call me Ishmael. Some years ago—never mind how long precisely-having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail abo...
1,331
machine translation
Machine Translation (possible approaches)
https://stackoverflow.com/questions/53972928/machine-translation-possible-approaches
<p>Recently, I’ve been thinking a lot about what to code. I thought about projects that enhance my skill in programming and general problem solving. Also, I wanted something that has an actual purpose. Honestly, I’m interested in building a translator. But not one for programming but one for human languages. For examp...
1,332
machine translation
Machine translation transformer with context
https://stackoverflow.com/questions/76299944/machine-translation-transformer-with-context
<p>I'm working on a transformer for seq2seq translation that has the typical encoder-decoder structure. I want to include examples of similar sentences and their translations in the prompt (few-shot) but I could only find guides that just translate one sentence to another without other context. Are there any best pract...
<p>You looking for the NLP task &quot;Context Aware NMT&quot;. There is some work in the field.</p> <p>Take a look at this research: <a href="https://link.springer.com/article/10.1007/s10994-021-06070-y" rel="nofollow noreferrer">A study of BERT for context-aware neural machine translation</a></p> <hr /> <p>If you want...
1,333