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
def count_lines(path): | |
with open(path,mode='r',encoding='utf-8') as f: | |
return sum([1 for _ in f]) | |
def load_vocabulary(path): | |
with open(path,mode='r',encoding='utf-8') as f: | |
# +2 for UNK and EOS | |
word_ids = {line.strip(): i + 2 for i, line in enumerate(f)} | |
word_ids['<UNK>'] = 0 |
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
$ sudo yum install --enablerepo=epel lsyncd |
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
# ls -ld /tmp | |
dr-xr-xr-x. 11 root root 4096 Aug 21 04:08 /tmp |
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
private void setViews(String strResult) { | |
textView.setText(""); | |
Gson gson = new Gson(); | |
StringBuffer list = new StringBuffer(); | |
AnalysisInDomainResult result = gson.fromJson(strResult, AnalysisInDomainResult.class); | |
JsonArray detectedCelebs = result.result.get(API_MODEL).getAsJsonArray(); | |
Log.d("MaiActivity", "detectedCelebs:" + detectedCelebs.toString()); | |
for (JsonElement element : detectedCelebs) { | |
JsonObject celeb = element.getAsJsonObject(); |
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
private void setViews(String strResult) { | |
textView.setText(""); | |
Gson gson = new Gson(); | |
StringBuffer list = new StringBuffer(); | |
AnalysisInDomainResult result = gson.fromJson(strResult, AnalysisInDomainResult.class); | |
JsonArray detectedCelebs = result.result.get(API_MODEL).getAsJsonArray(); | |
Log.d("MaiActivity", "detectedCelebs:" + detectedCelebs.toString()); | |
for (JsonElement element : detectedCelebs) { | |
JsonObject celeb = element.getAsJsonObject(); |