Skip to content

Instantly share code, notes, and snippets.

@ayushoriginal
Created June 24, 2019 12:34
Show Gist options
  • Save ayushoriginal/2fe6f3abab6ccac7e3dd97e96552b10b to your computer and use it in GitHub Desktop.
Save ayushoriginal/2fe6f3abab6ccac7e3dd97e96552b10b to your computer and use it in GitHub Desktop.
word_index
int len_tweet = 0;
int size_vocab = 0;
// Tweet Length and Size of Vocab
foreach (var line in File.ReadLines("metadata_length_tweet_size_vocab.txt"))
{
string[] temp = line.Split(" ");
len_tweet = Convert.ToInt32(temp[0]);
size_vocab = Convert.ToInt32(temp[1]);
}
// Vocab Mapping
var word_code = new Dictionary<string, int>();
string temp_word = null;
int temp_code = 0;
foreach (var line in File.ReadLines("vocab_mapping.txt"))
{
string[] temp2 = line.Split(" ");
temp_word = temp2[0];
temp_code = Convert.ToInt32(temp2[1]);
if (word_code.ContainsKey(temp_word))
{
continue;
}
else
{
word_code.Add(temp_word, temp_code);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment