First of all, I apologize if this question is not formatted with an immediately runnable MWE. There is a text dependency that I’ve tried my best to reformat an in-code array so to prevent those helping me from having to download and save a text file, but I have failed at being able to format the data correctly. Also, JuliaBox does not play with my code despite it working just fine on my 0.6 machine. Sorry again for this, I really tried.
Anyway, here’s my question. I am extracting all numbers from a file line-by-line (variable a). My code outputs the correct information, but not line by line. As always, I feel as though I am really close to figuring this out (stupidly missing a dot or something.)
I’ve tried setting
push!(phoneticaccents[n],0) in the inner loop, but that doesn’t work.
What currently happens:
phoneticaccents = [1 0 2 2 0 1 0] phonetic information for all words in one list
What I want
phoneticaccents[1,:] = 1 0 2 #phonetic information for word 1
phonetic accents[2,:] = 2 0 1 0 #phonetic information for word 2
a = readdlm("Sphinx.txt") for n = 1:size(a,1) for m = 2:size(a[n,:],1) if search(a[n,m],'0') > 0 push!(phoneticaccents,0) end if search(a[n,m],'1') > 0 push!(phoneticaccents,1) end if search(a[n,m],'2') > 0 push!(phoneticaccents,2) end end end
Here’s part of my Sphinx.txt file
EXCLAMATION-POINT EH2 K S K L AH0 M EY1 SH AH0 N P OY2 N T CLOSE-QUOTE K L OW1 Z K W OW1 T DOUBLE-QUOTE D AH1 B AH0 L K W OW1 T END-OF-QUOTE EH1 N D AH0 V K W OW1 T END-QUOTE EH1 N D K W OW1 T IN-QUOTES IH1 N K W OW1 T S QUOTE K W OW1 T UNQUOTE AH1 N K W OW1 T HASH-MARK HH AE1 M AA2 R K POUND-SIGN P AW1 N D S AY2 N SHARP-SIGN SH AA1 R P S AY2 N PERCENT P ER0 S EH1 N T AMPERSAND AE1 M P ER0 S AE2 N D 'ALLO AA2 L OW1