apeiros changed the topic of #ruby-lang to: Nick registration required to talk || Ruby 2.0.0-p247: http://ruby-lang.org (Ruby 1.9.3-p448) || Paste >3 lines of text on http://gist.github.com
<captain_chen> Each element is an array right?
<drbrain> for scan, if you don't capture, each element will be a string
apeiros has quit [Remote host closed the connection]
<drbrain> can you show what you have so far?
tkuchiki has joined #ruby-lang
apeiros has joined #ruby-lang
<captain_chen> I haven't done much yet
hramrach has joined #ruby-lang
<captain_chen> All I've done is change the regex to grab the I since that might be useful for getting the ID
<drbrain> I would grab ID and document separately
<drbrain> at least to start
<captain_chen> I'm doing that whole
<drbrain> it is possible to grab them together
<captain_chen> Grab the whole document and make an array of documents
<drbrain> still, what do you have?
CoreData has quit [Ping timeout: 246 seconds]
<drbrain> yes, use scan to grab the whole document and make an array of documents
apeiros has quit [Read error: Operation timed out]
nertzy has quit [Quit: This computer has gone to sleep]
<captain_chen> Using that array of documents, iterate through them to grab the ID and also the text.
<drbrain> yes
iliketurtles has joined #ruby-lang
<captain_chen> It'd make sense for me to do say, id = documents.each { |e| <something here to see if it's an ID> }?
jewing has quit [Remote host closed the connection]
<drbrain> I think:
<drbrain> documents.each do |d| id = get_id_from d; text = get_text_from d; tokens = tokenize text; update_index index, id, tokens; end
<drbrain> so each document (d) would look like ".I 1\n.T\nBlah Blah title …"
<captain_chen> Yeah so
<captain_chen> Would I use another regexp to see if the element contains the .I [0-9]
<drbrain> yes
<captain_chen> so in the block, it'd be |e| e.match(/^(.i [0-9])/ or something?
<drbrain> almost
<drbrain> the regular expression should be /^.I ([0-9]+)/
<drbrain> you can shorten it to /^.I (\d+)/
<drbrain> oh, and you want to escape the period because it matches anything
<drbrain> so: /^\.I (\d+)/
<captain_chen> I probably should learn regexps after this lol
<drbrain> and you can use String#[] with a regular expression:
imperator has left #ruby-lang ["Leaving"]
<drbrain> id = document[/^\.I (\d+)/, 1]
<drbrain> it will be a String instead of an Integer, so you'll need to convert it
grough has quit []
<drbrain> well, may need to convert it
<captain_chen> hm
digs has joined #ruby-lang
digs is now known as Guest65918
<captain_chen> So would this not work then? id = documents.each { |e| e.match(/^\.I (\d+)/)}
<captain_chen> Oh wait.
<drbrain> captain_chen: it will, but you'll need to get the id out of the match data object #match returns
<drbrain> String#[] lets you match and extract the id in one operation instead of two
grough has joined #ruby-lang
tylersmi_ has quit [Remote host closed the connection]
tylersmith has joined #ruby-lang
jsullivandigs has quit [Ping timeout: 264 seconds]
ssb123 has joined #ruby-lang
<captain_chen> Okay so this is what I'm trying to do.
<drbrain> captain_chen: you can try in irb too
<captain_chen> Maybe I should just repaste what I have.
<captain_chen> But I load in the content, which is that test.txt file.
<drbrain> >> ".I 52\n".match(/^\.I (\d+)/)
<eval-in> drbrain => #<MatchData ".I 52" 1:"52"> (https://eval.in/52748)
<drbrain> >> ".I 52\n".match(/^\.I (\d+)/)[1]
<eval-in> drbrain => "52" (https://eval.in/52749)
<drbrain> >> ".I 52\n"[/^\.I (\d+)/, 1]
<eval-in> drbrain => "52" (https://eval.in/52750)
<captain_chen> Okay let me try this thing.
<captain_chen> And this works in the block?
<drbrain> yes
tylersmith has quit [Ping timeout: 264 seconds]
ykk` has joined #ruby-lang
<captain_chen> so that would be: id = documents.each {|e| e[/regexp/, 1] }?
<drbrain> no, inside
<drbrain> you want to extract both the ID and the text from the same document at the same time
Coincidental has quit [Remote host closed the connection]
<drbrain> this way they stay associated when you update the index
jarm has joined #ruby-lang
<drbrain> (also, use "d" for "document" if you're going to use short variables)
<drbrain> (instead of "e" for "element"? "entry"?)
<captain_chen> I'm lost again on how to do this, writing it out I mean.
<captain_chen> You load the file, scan the documents and it generates an array of documents.
<captain_chen> then you extract the ID and the text from the array of documents, right?
<drbrain> yes, in the same iteration
<drbrain> can you show what you have?
<drbrain> it's easier to talk about lines
nathanstitt has joined #ruby-lang
sepp2k1 has quit [Ping timeout: 260 seconds]
<drbrain> captain_chen: I would get rid of the groups in the scan on line 9
<drbrain> captain_chen: you can make that optimization in the future when you have the rest of your code working
benanne has quit [Quit: kbai]
stamina has quit [Ping timeout: 252 seconds]
<captain_chen> the regexp you mean?
<drbrain> yes, the () in the regexp
<drbrain> then, I would uncomment the =begin/=end on lines 32 and 40
<drbrain> and put a "p document" between 34 and 35
<captain_chen> I guess my issue is I'm not exactly sure how you use that String#[/regexp/, 1] while iterating through the documents array
iliketurtles has quit [Quit: zzzzz…..]
hahuang65 has quit [Ping timeout: 240 seconds]
<drbrain> you put that on line 23
iliketurtles has joined #ruby-lang
<captain_chen> This: documents.each{|element| element[/^\.I (\d+)/, 1]}?
<drbrain> just: element[/^\.I (\d+)/, 1]
<drbrain> since line 34 has the each already
<drbrain> so you only have one document to work on
<drbrain> captain_chen: after line 9, everything should be done one document at a time
<captain_chen> Okay, so those extract_id and extract_text methods
<captain_chen> They're using that String#[] match thingy right?
<drbrain> that's what I would use
<drbrain> you should be able to check yourself by running printing the id between lines 35 and 36
<captain_chen> Okay, I updated the pastebin
<captain_chen> In the extract_id which accepts a document array
<captain_chen> I just have document[/regexp/, 1]
<drbrain> extract id accepts a document, not document array
<drbrain> it looks good
<drbrain> if you change line 35 to: p id => document
<drbrain> do you get expected output?
<drbrain> oh, you forgot to remove the () from line 9
<drbrain> it should be only: documents = content.scan(/^\.I \d+.*?\.B/m)
<captain_chen> And that's why it wasn't working properly?
<captain_chen> Those ()'s?
<drbrain> if you use capturing groups, the ()s, in the regular expression for scan it returns the captured groups instead of the whole match
verto has quit [Ping timeout: 246 seconds]
<captain_chen> Oh, no wonder this sounded like magic.
<captain_chen> Okay, we're on the same page again. Sorry I'm a little slowl.
<captain_chen> *slow
<drbrain> I want you to do it without the capturing in your scan because it'll be a little easier to figure out the steps
ssb123 has quit [Remote host closed the connection]
<drbrain> afterward, you can switch back to those
<drbrain> it will be more efficient to do it with () in the first scan
ssb123 has joined #ruby-lang
<drbrain> but more difficult to explain
<captain_chen> Okay so on line 31, that documents.each
<captain_chen> Where it calls the various methods etc, I use that to generate the hash right?
<drbrain> yes
<captain_chen> And the extract_text method is similar to the extract_Id
<drbrain> yes
arBmind has quit [Quit: Leaving.]
<captain_chen> So now I just need to figure out a regexp to grab all text
Coincidental has joined #ruby-lang
hogeo has joined #ruby-lang
<drbrain> your previous regexp, I think it was something like: /^\.T(.*?)^\.B/m, should work
ssb123 has quit [Ping timeout: 245 seconds]
postmodern has joined #ruby-lang
<captain_chen> What's that '1' do in the document[/regexp/,1]?
<drbrain> that uses the first capture group
<drbrain> if you were matching, say, dates:
<drbrain> >> "2013-10-04"[/(\d{4})-(\d{2})-(\d{2})/, 2]
<eval-in> drbrain => "10" (https://eval.in/52756)
yfeldblum has quit [Ping timeout: 264 seconds]
<captain_chen> It says capture?
<captain_chen> Oh, so if I used a regexp, those ()'s are groups?
<drbrain> yes
<captain_chen> Oh I see, I see.
<captain_chen> I just looked it up.
brianpWins has quit [Quit: brianpWins]
<drbrain> if you don't use [//, 1], you get the whole match
<drbrain> >> "foo"[/.(o)./]
<eval-in> drbrain => "foo" (https://eval.in/52757)
schaerli has joined #ruby-lang
charliesome has joined #ruby-lang
cored has quit [Ping timeout: 264 seconds]
<captain_chen> Yeah I should learn Regular Expressions after I get this working.
<captain_chen> They're pretty useful if used properly.
schaerli has quit [Ping timeout: 240 seconds]
<captain_chen> So I'm assuming that before that documents.each, I make the hash then inside I start putting in the keys and values
bzalasky has joined #ruby-lang
<drbrain> yes
<drbrain> you should get tokenizing working first
<captain_chen> Well since text is just a string, you can just split it right?
<captain_chen> And this is where I can do gsubs on removing question marks etc.
<drbrain> yes
<drbrain> you can also use text.scan(/\w+/)
<captain_chen> And this is where I can do gsubs on removing question marks etc.
<captain_chen> Whoops
richardburton has joined #ruby-lang
grough has quit []
<captain_chen> Forgot to mention, thank you for your help thus far.
<drbrain> np
<captain_chen> I'll make a 'choose your own adventure' in HTML5 eventually and you can maybe play it
jarm has quit [Ping timeout: 240 seconds]
<drbrain> :)
<captain_chen> If you want, that is lol.
<captain_chen> I'm more comfortable with hypertext markup, css and graphics honestly.
<captain_chen> Now that I think about it
<captain_chen> I should have thought of extracting the documentID, title and abstract like the box model
<captain_chen> versus words in a bag
<drbrain> yes, it's much like that
<drbrain> but unlike the DOM, you have to do your own parsing
robbyoconnor has joined #ruby-lang
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<captain_chen> I think I like html & css because it's instant gratification of your markup displayed in a browser versus coding but I shouldn't really complain.
grough has joined #ruby-lang
grough has quit [Client Quit]
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
lsegal has joined #ruby-lang
iliketurtles has quit [Quit: zzzzz…..]
bzalasky_ has joined #ruby-lang
bzalasky has quit [Read error: Connection reset by peer]
ssb123 has joined #ruby-lang
<captain_chen> What was that thing about hashes again? You could have as many keys point to the same value?
eponymi has joined #ruby-lang
lsegal has quit [Client Quit]
nisstyre has quit [Quit: Leaving]
bzalasky_ has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
lsegal has joined #ruby-lang
richardburton has left #ruby-lang [#ruby-lang]
bzalasky has quit [Ping timeout: 256 seconds]
ssb123 has quit [Ping timeout: 245 seconds]
hashkey has joined #ruby-lang
grough has joined #ruby-lang
bzalasky has joined #ruby-lang
hogeo has quit [Quit: Leaving...]
mistym has quit [Remote host closed the connection]
mbj_ has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
bzalasky has joined #ruby-lang
symm- has quit [Ping timeout: 246 seconds]
mbj has quit [Ping timeout: 260 seconds]
robbyoconnor has quit [Ping timeout: 245 seconds]
lsegal has joined #ruby-lang
nertzy has joined #ruby-lang
eponymi has quit [Quit: Colloquy for iPhone - http://colloquy.mobi]
nathanstitt has quit [Ping timeout: 240 seconds]
bzalasky has quit [Ping timeout: 264 seconds]
<drbrain> index = Hash.new { |index, keyword| index[keyword] = [] }
<drbrain> then use: index[keyword] << id
nathanstitt has joined #ruby-lang
<drbrain> time for TV for me, good luck!
<captain_chen> thanks a lot, and enjoy your tele
ikrima has quit [Quit: Computer has gone to sleep.]
rickhull has joined #ruby-lang
<rickhull> slightly offtopic, is there a good way in bash to refer to directory that the executing script lives in?
<rickhull> the bash equivalent of File.expand_path('..', __FILE__) I suppose
<rickhull> e.g so i can cd into a subdir relative to the executing script, rather than cd into a subdir relative to $PWD, which is where the script was called from
nertzy has quit [Quit: This computer has gone to sleep]
<rickhull> tldr `DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"`
<rickhull> do people really do this? or do they just put the bash down and try something else?
<rickhull> to me it's useless to do stuff inside a script, relative the PWD/CWD of the user executing it
<rickhull> the user could call the script from anywhere, and why would i care what his CWD is, inside the script? i mean i'm sure there's a use case
<rickhull> i just get the distinct feeling I'm Doing It Wrong (tm)
apeiros has joined #ruby-lang
<rickhull> then again, that feeling never goes away when using bash IME
omninonsense has quit [Remote host closed the connection]
<captain_chen> I've no clue lol
nertzy has joined #ruby-lang
<rickhull> some approaches
lun__ has joined #ruby-lang
ykk` has quit [Quit: ykk`]
<rickhull> my goal is to be able to drop this "entry" script anywhere on the filesystem, and then someone from the outside, if they can find their way to the entry script, the entry script knows how to get to everything else, project-wise, relative to that entry script
<rickhull> i.e. sets up some project globals that other scripts/components can use
<rickhull> my concern is that bash is simply completely ill-suited for something like this, but part of me really doesn't believe that's true
<rickhull> taking a step back, this is a repository of test scripts, most of which are implemented in bash. and everything lives in one dir and shares lots of promiscuous state
<rickhull> i'm adding python and ruby capabilities to this repo. but bash is the underlying lingua franca
<rickhull> this repo is primarily consumed by jenkins, which has a bash interface for the job def
<rickhull> so one of the first things jenkins needs to do, with the new ruby stuff, is find the Gemfile, and then execute bundler properly
<rickhull> i was hoping to abstract this a bit, with a helper script inside the repo
<rickhull> so that jenkins doesn't need to know promiscuous details about the repo structure
headius has joined #ruby-lang
<rickhull> i.e. jenkins would just call ./ruby/setup.sh
<rickhull> er, ./ruby/setup.bash (w/e)
<rickhull> but setup.bash needs to know how to find the Gemfile, relative to where it lives
<rickhull> am I just Doing It Wrong (™)?
<rickhull> and setup.bash has all of the bundler install parameters to do the right thing
<rickhull> part of me thinks we should just implement all of our test scripts in python or ruby, and completely eschew bash
<rickhull> but bash seems to be the underlying layer. it's useful for piping and redirection and blocking on `nc` etc.
<rickhull> it's much more natural for bash to call a python script than for python to call a bash script
nathanstitt has quit [Quit: I growing sleepy]
schaerli has joined #ruby-lang
<rickhull> the other problem i'm having, is that i potentially want every bash script to be able to find things relative to the dir it lives in
<rickhull> but i don't want to cargocult copypasta that horrible DIR line everywhere
<rickhull> so ideally i could define it once, and then reference it. but you have the self-referential problem that the place that defines the containing-dir process will just execute according to where the definition lives, not who called it
<rickhull> is it that unreasonable for X to want to find Y, within a project, relative to where X lives?
<rickhull> shouldn't we, or don't we, have better tools for this?
<rickhull> /rant
<rickhull> i'd really like to get some feedback, but i gotta run. i'll plan to log back in from home
ikrima has joined #ruby-lang
schaerli has quit [Ping timeout: 245 seconds]
nathanstitt has joined #ruby-lang
shinnya has quit [Read error: Operation timed out]
ikrima has quit [Ping timeout: 245 seconds]
ikrima has joined #ruby-lang
ikrima has quit [Remote host closed the connection]
Coincidental has quit [Remote host closed the connection]
Coincidental has joined #ruby-lang
Coincidental has quit [Ping timeout: 260 seconds]
ykk` has joined #ruby-lang
nvg has quit [Quit: Changing servers]
Bosox20051 has joined #ruby-lang
RickHull1 has joined #ruby-lang
<RickHull1> did i miss any good feedback?
headius has quit [Quit: headius]
ssb123 has joined #ruby-lang
ssb123 has quit [Remote host closed the connection]
ssb123 has joined #ruby-lang
AOrtenzi has joined #ruby-lang
nertzy has quit [Quit: This computer has gone to sleep]
ssb123 has quit [Ping timeout: 245 seconds]
Guest65918 has quit [Remote host closed the connection]
mdedetrich has quit [Quit: Computer has gone to sleep.]
jarm has joined #ruby-lang
AOrtenzi has quit []
lun___ has joined #ruby-lang
lun__ has quit [Ping timeout: 264 seconds]
kgrz has joined #ruby-lang
kgrz has quit [Remote host closed the connection]
Tearan has joined #ruby-lang
kgrz has joined #ruby-lang
ssb123 has joined #ruby-lang
ssb123 has quit [Remote host closed the connection]
ssb123 has joined #ruby-lang
cyndis_ has joined #ruby-lang
kgrz has quit [Read error: Connection reset by peer]
cyndis has quit [Remote host closed the connection]
kgrz has joined #ruby-lang
kgrz has quit [Read error: Connection reset by peer]
kgrz has joined #ruby-lang
kgrz_ has joined #ruby-lang
kgrz_ has quit [Client Quit]
ssb123 has quit [Ping timeout: 245 seconds]
dhruvasagar has joined #ruby-lang
charliesome has joined #ruby-lang
mistym has joined #ruby-lang
Tearan has quit [Quit: Sleepy Badger....]
Tearan has joined #ruby-lang
headius has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
Tearan has quit [Quit: Sleepy Badger....]
retro|cz has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 260 seconds]
richardburton has joined #ruby-lang
robbyoconnor has joined #ruby-lang
Tearan has joined #ruby-lang
Guest66192 has joined #ruby-lang
Kabaka has quit [Ping timeout: 240 seconds]
Coincidental has joined #ruby-lang
Tearan has quit [Client Quit]
kenta_ has joined #ruby-lang
richardburton has quit [Ping timeout: 240 seconds]
_jpb_ has quit [Remote host closed the connection]
jithu has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
robbyoconnor has quit [Read error: Connection reset by peer]
Bosox20051 has quit [Read error: Connection reset by peer]
ykk` has quit [Quit: ykk`]
Bosox20051 has joined #ruby-lang
captain_chen has quit [Quit: Page closed]
richardburton has joined #ruby-lang
ssb123 has joined #ruby-lang
kgrz has quit [Remote host closed the connection]
ssb123 has quit [Ping timeout: 245 seconds]
kgrz has joined #ruby-lang
lsegal has joined #ruby-lang
lsegal has quit [Client Quit]
kgrz has quit [Ping timeout: 245 seconds]
<xybre> rickhull: That tldr line is the best way to do that in bash, yes.
<xybre> rickhull: Bash is really powerful and can do a hell of a lot its fast and its worth learning.
ged has quit [Read error: Connection reset by peer]
chinno998 has joined #ruby-lang
chinno998 has left #ruby-lang [#ruby-lang]
ged has joined #ruby-lang
xrq has quit [Remote host closed the connection]
xrq has joined #ruby-lang
lun___ has quit [Remote host closed the connection]
lun__ has joined #ruby-lang
jithu has quit [Quit: Mother, did it need to be so high?]
lun__ has quit [Read error: Connection reset by peer]
lun__ has joined #ruby-lang
postmodern has quit [Quit: Leaving]
captain-chen has joined #ruby-lang
mistym has quit [Ping timeout: 240 seconds]
Zerogrifter has quit [Ping timeout: 264 seconds]
amerine has quit [Quit: Textual IRC Client: www.textualapp.com]
Oak has joined #ruby-lang
mistym has joined #ruby-lang
jarm has quit [Ping timeout: 252 seconds]
nathanstitt has quit [Quit: I growing sleepy]
iliketurtles has joined #ruby-lang
iliketurtles has quit [Client Quit]
captain-chen has quit [Quit: Page closed]
captain_chen has joined #ruby-lang
mistym has quit [Ping timeout: 264 seconds]
<captain_chen> can anyone answer a question for me?
richardburton has quit [Quit: Leaving.]
dhruvasagar has joined #ruby-lang
GaelanAintAround is now known as Gaelan
io_syl has quit []
lsegal has joined #ruby-lang
mistym has joined #ruby-lang
nneko001__ has joined #ruby-lang
dik_dak has joined #ruby-lang
nofxx has quit [Ping timeout: 245 seconds]
hakunin_ has joined #ruby-lang
hakunin has quit [Read error: Connection reset by peer]
kgrz has joined #ruby-lang
Gaelan is now known as GaelanAintAround
sevvie has quit [Ping timeout: 264 seconds]
jsullivandigs has joined #ruby-lang
jsullivandigs has quit [Remote host closed the connection]
GaelanAintAround is now known as Gaelan
jithu has joined #ruby-lang
kgrz has quit [Ping timeout: 246 seconds]
iliketurtles has joined #ruby-lang
postmodern has joined #ruby-lang
nneko001__ has quit [Quit: Konversation terminated!]
dik_dak has quit [Quit: Leaving]
Tearan has joined #ruby-lang
tomzx_mac has quit [Read error: Connection reset by peer]
tomzx_mac has joined #ruby-lang
bzalasky has joined #ruby-lang
iliketurtles has quit [Quit: Textual IRC Client: www.textualapp.com]
captain_chen has quit [Quit: Page closed]
hogeo has joined #ruby-lang
jeff_r has joined #ruby-lang
jeff_r_ has joined #ruby-lang
hogeo has quit [Remote host closed the connection]
Mon_Ouie has joined #ruby-lang
Mon_Ouie has quit [Changing host]
Mon_Ouie has joined #ruby-lang
jeff_r has quit [Ping timeout: 246 seconds]
mdedetrich has joined #ruby-lang
tonni has quit [Remote host closed the connection]
Gaelan is now known as GaelanAintAround
richardburton has joined #ruby-lang
ruby-lang135 has joined #ruby-lang
ruby-lang135 has quit [Client Quit]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
manoj9788 has joined #ruby-lang
<manoj9788> hi
<manoj9788> i am new to ruby and here to seek some help on Ruby and Rspec.
<manoj9788> can any one ?
jacktrick has quit [Ping timeout: 248 seconds]
hogeo has joined #ruby-lang
hogeo has quit [Client Quit]
Guest66192 has quit [Ping timeout: 240 seconds]
jeff_r_ has quit [Remote host closed the connection]
tonni has joined #ruby-lang
Guest66192 has joined #ruby-lang
GaelanAintAround is now known as Gaelan
tomzx_mac has quit [Ping timeout: 245 seconds]
Gaelan is now known as GaelanAintAround
<manoj9788> hey can any one help ?
robbyoconnor has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
headius has quit [Quit: headius]
jxie has quit [Read error: Connection reset by peer]
jxie has joined #ruby-lang
lsegal has joined #ruby-lang
jiuweigui has joined #ruby-lang
jxie has quit [Read error: Connection reset by peer]
jxie has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
iliketurtles has joined #ruby-lang
relix has joined #ruby-lang
shinnya has joined #ruby-lang
bzalasky has quit [Ping timeout: 252 seconds]
wallerdev has quit [Quit: wallerdev]
Tearan has quit [Quit: Sleepy Badger....]
rippa has joined #ruby-lang
alexju has quit [Remote host closed the connection]
alexju_ has joined #ruby-lang
schaerli has joined #ruby-lang
banisterfiend has quit [Quit: Computer has gone to sleep.]
jeff_r has joined #ruby-lang
lun__ has quit [Ping timeout: 264 seconds]
jeff_r has quit [Ping timeout: 264 seconds]
lun__ has joined #ruby-lang
tonni has quit [Remote host closed the connection]
alexju_ has quit [Remote host closed the connection]
alexju has joined #ruby-lang
tbuehlmann has joined #ruby-lang
schaerli has quit [Remote host closed the connection]
captain_chen has joined #ruby-lang
alexju has quit [Ping timeout: 264 seconds]
<captain_chen> Anyone happen to be alive?
<tbuehlmann> yupyup
<captain_chen> Could you help answer a question for me before I pass out?
diegoviola has joined #ruby-lang
<tbuehlmann> hard to say. I'd say you just ask
<captain_chen> file to load: http://pastebin.com/7s7H0akP
<captain_chen> That program creates a Hash that points to an array
<captain_chen> If you generate the index, it'll evaluate to: [["preliminary", "report-international", "algebraic", "language"] => ["1"], ["preliminary", "report-international", "algebraic", "language", "space", "cat"] =>["2"]]
<captain_chen> However, it doesn't take into consideration same keys.
<captain_chen> This is the desired output: [["preliminary", "report-international", "algebraic", "language"] => ["1, 2"], ["space", "cat"] =>["2"]]
<captain_chen> On line 63 is where I pass in the extracted information.
<captain_chen> There was an example online where
metus_violarium has joined #ruby-lang
<captain_chen> hash = Hash.new{ |h,k| h [k] =[] }
jxie has quit [Quit: leaving]
nisstyre has joined #ruby-lang
kgrz has joined #ruby-lang
kgrz has quit [Remote host closed the connection]
<captain_chen> hash["hello"] << "kitty" #=> {"hello" => "kitty"}
kgrz has joined #ruby-lang
<captain_chen> hash["hello"] << "world" #=> {"hello" => ["kitty","world"]}
<captain_chen> That's about it.
<tbuehlmann> eh, what's the question again?
<captain_chen> Sorry, I want to get from: [["preliminary", "report-international", "algebraic", "language"] => ["1"], ["preliminary", "report-international", "algebraic", "language", "space", "cat"] =>["2"]]
<captain_chen> To: [["preliminary", "report-international", "algebraic", "language"] => ["1, 2"], ["space", "cat"] =>["2"]]
kgrz_ has joined #ruby-lang
kgrz has quit [Read error: Connection reset by peer]
<tbuehlmann> do you have to use such a bad data structure? :\
<captain_chen> I'm not too great with data structures, sorry.
<captain_chen> Do you have a better idea?
<tbuehlmann> I don't understand what you're doing at all. so you have a text file, what are you doing with it?
<captain_chen> I'm extracting the documentID number, it's next to the .I
<captain_chen> I'm also extracting the text under the .T (title) and .W (abstract)
<captain_chen> I get the docID, and the text from the tittle and abstract to tokenize.
<captain_chen> *title
<captain_chen> Then I pass these values into the hash.
<captain_chen> The hash should then have a list of terms that point to the documentID that has the term in it.
tonni has joined #ruby-lang
CoreData has joined #ruby-lang
hramrach has quit [Remote host closed the connection]
hramrach has joined #ruby-lang
<tbuehlmann> um, what if only "algebraic" would be in document 3? would you then have to remove it from the other key?
<captain_chen> If the term appears in other documents, it should point to that document too.
<captain_chen> Maybe my data structure doesn't work well after all.
<tbuehlmann> do you need to have it that way? I mean, do you need to group title words that way?
jacktrick has joined #ruby-lang
<captain_chen> term to its documentID, yes.
<captain_chen> If you're talking about the file where I parse in the information, it's preformatted in that way.
<tbuehlmann> naw
<tbuehlmann> you want to group as many document words as possible per documents?
<captain_chen> Would that work properly with my current data structure though?
<tbuehlmann> I still don't get the gist of it..
<captain_chen> Sorry, I'm making an information retrieval system.
<captain_chen> I take in a collections file, that test.txt is a small-scale model of the much larger collection.
<captain_chen> And parse in information such as the document's ID, its title and abstract.
<captain_chen> So in that test.txt, there are two "documents"
<captain_chen> With document IDs, 1 and 2
<tbuehlmann> right
<captain_chen> Both have a title which I parse in through the program then tokenize them to be put into the hash.
<tbuehlmann> why tokenize?
charliesome has joined #ruby-lang
<captain_chen> Going to be matched up with a query
<captain_chen> Of a single term
<captain_chen> So say the hash current has: {["cat", "planet"] => ["1, 2"], "dog" => ["2"]}
schaerli has joined #ruby-lang
<captain_chen> Wait, oh
<captain_chen> I blame the tiredness, I just realize that makes no sense.
<tbuehlmann> I hope so, because I don't understand either :)
<captain_chen> The gist is, the program receives a single term
CoreData has quit [Quit: CoreData]
<captain_chen> It checks it against the data structure and sees which document contains the term.
CoreData has joined #ruby-lang
<tbuehlmann> and you want a clever data structure to minimize the time running?
<captain_chen> That or easy to understand.
<captain_chen> Or both.
<tbuehlmann> then, why not something like this: {'1' => ['Preliminary', 'Report-International', 'Algebraic', 'Language'], ...}
<captain_chen> I just need a data structure that can do what I'm trying to achieve. That sounds about right.
apeiros has quit [Remote host closed the connection]
<tbuehlmann> then, loop through the values and search for terms for a query
apeiros has joined #ruby-lang
<captain_chen> So just flip the key and values?
<captain_chen> I'm still stuck with duplicate terms appearing and not pointing to the documents that also have them
<captain_chen> Like doc1: cat planet, doc2: dog planet, if I search 'planet' it should point to both doc1 & doc2
adambeynon has joined #ruby-lang
schaerli has quit [Remote host closed the connection]
<tbuehlmann> let's pretend you have it like {'1' => ['Preliminary', 'Report-International', 'Algebraic', 'Language'], ...}
<tbuehlmann> the document pointing to the terms
schaerli has joined #ruby-lang
<captain_chen> Oka.
<captain_chen> -y
chinno998 has joined #ruby-lang
chinno998 has left #ruby-lang [#ruby-lang]
<tbuehlmann> and you search for "Algebraic", you would simply loop through all values and get the key, if the term appears. eventually you get all document ids where the term Algebraic appears
schaerli has quit [Ping timeout: 245 seconds]
<captain_chen> Oh, does it still work out?
<captain_chen> My current data structure.
<captain_chen> Oh, I see what you mean.
<captain_chen> It's just not grouped together
<tbuehlmann> right
<captain_chen> i.e. ['Algebraic'] => ["2","3"]
<captain_chen> There's a command to group, no?
<captain_chen> But anyway, thanks for clarifying what should have been clear the first time.
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<captain_chen> If I see you around, I will let you try a "choose your own adventure" game in HTML5 once I get started on it.
<captain_chen> It's 5 AM so I'll be going now, thanks.
captain_chen has quit [Quit: Page closed]
<tbuehlmann> just a sec
<tbuehlmann> ar!
mistym has quit [Remote host closed the connection]
banisterfiend has joined #ruby-lang
CoreData has quit [Ping timeout: 256 seconds]
rippa has quit [Ping timeout: 248 seconds]
ndrst has joined #ruby-lang
rippa has joined #ruby-lang
CoreData has joined #ruby-lang
sevvie has joined #ruby-lang
workmad3 has joined #ruby-lang
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
CoreData has quit [Ping timeout: 256 seconds]
tharindu has joined #ruby-lang
kenta_ has quit [Remote host closed the connection]
kenta_ has joined #ruby-lang
captain_chen has joined #ruby-lang
<captain_chen> welp
Nss has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 260 seconds]
kenta_ has quit [Ping timeout: 256 seconds]
<tbuehlmann> two data structures, both make somehow sense. depend on you, what is more appropriate
kgrz_ has quit [Ping timeout: 264 seconds]
MaddinXx has joined #ruby-lang
<captain_chen> The second one.
<captain_chen> How would you automate the generation?
tharindu has quit [Quit: No Ping reply in 180 seconds.]
tharindu has joined #ruby-lang
Coincidental has quit [Remote host closed the connection]
Coincidental has joined #ruby-lang
tkuchiki has quit [Remote host closed the connection]
tkuchiki has joined #ruby-lang
<captain_chen> Isn't that what I have right now?
mucker has quit [Ping timeout: 245 seconds]
tkuchiki_ has joined #ruby-lang
tkuchiki has quit [Read error: Connection reset by peer]
CoreData has joined #ruby-lang
tharindu has quit [Client Quit]
tkuchiki_ has quit [Remote host closed the connection]
tkuchiki has joined #ruby-lang
Coincidental has quit [Ping timeout: 264 seconds]
tharindu has joined #ruby-lang
tkuchiki has quit [Ping timeout: 240 seconds]
iliketurtles has quit [Quit: zzzzz…..]
<captain_chen> In your example, yuo can't access the value by giving the hash the key right?
<captain_chen> Gah, I need to sleep. If you can, /msg me so I can read your process if you feel like continuing trying to help.
<captain_chen> Otherwise, thank you for your help thus far.
<tbuehlmann> "In your example, yuo can't access the value by giving the hash the key right?" - if you have the key, you get the value. that's a hash
tharindu has quit [Ping timeout: 264 seconds]
<captain_chen> So in your example, if I passed data['Preliminary'] it would return '1' right?
<tbuehlmann> nope, ['1']
<captain_chen> When I run it, I don't see anything.
<tbuehlmann> my gist?
<captain_chen> Yeah
<tbuehlmann> works for me
benanne has joined #ruby-lang
<captain_chen> Processing.rb?
<tbuehlmann> yup
<captain_chen> What the heck
<tbuehlmann> do you just run the file?
<tbuehlmann> paste it in an irb session and inspect `data`
<workmad3> there's no output, so 'ruby processing.rb' won't display anything
<captain_chen> I wrote puts data['Preliminary']
<tbuehlmann> yeah, that should work
<captain_chen> Nothing on the prompt
<tbuehlmann> that should return 1 to the console
charliesome has joined #ruby-lang
<captain_chen> Is it because my version of Ruby is outdated or something?
charliesome has quit [Client Quit]
<workmad3> captain_chen: doubt it
elia has joined #ruby-lang
mucker has joined #ruby-lang
<captain_chen> Yeah, nothing is showing up for me
<workmad3> captain_chen: so you copy-pasted the processing.rb into an irb session
<workmad3> captain_chen: and then did 'puts data['Preliminary']' ?
stamina has joined #ruby-lang
<captain_chen> Whoops
<captain_chen> I keep making that mistake, I blame my sleepiness.
sevvie has quit [Ping timeout: 245 seconds]
<captain_chen> workmad3, I saved the processing.rb into its own file and running it
RickHull1 has quit [Quit: Leaving.]
<captain_chen> but there's nothing appearing.
<workmad3> captain_chen: no, because that file doesn't print anything
arBmind has joined #ruby-lang
<captain_chen> However I tried using git bash and irb and it shows.
RickHull1 has joined #ruby-lang
<captain_chen> After I put the line: puts data['Preliminary']
<captain_chen> Okay, maybe I'm just tired but it's showing up now.
JoshuaPaling has joined #ruby-lang
<captain_chen> workmade3: why isn't it displaying in my program when I try accessing the hash with a key?
CoreData has quit [Ping timeout: 256 seconds]
elia has quit [Ping timeout: 240 seconds]
elia has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
<captain_chen> Oh, I think I see.
VTLob has joined #ruby-lang
<captain_chen> Yeah it's working now.
<captain_chen> It was because of the token I was passing in.
sevvie has joined #ruby-lang
sevvie has quit [Ping timeout: 264 seconds]
captain_chen has quit [Ping timeout: 250 seconds]
gjaldon has joined #ruby-lang
sepp2k has joined #ruby-lang
gjaldon has quit [Remote host closed the connection]
charliesome has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
elia has joined #ruby-lang
sooraj has joined #ruby-lang
workmad3 has quit [Ping timeout: 240 seconds]
ledestin has joined #ruby-lang
sevvie has joined #ruby-lang
cads has quit [Ping timeout: 246 seconds]
imperator has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
cored has joined #ruby-lang
sevvie has quit [Ping timeout: 256 seconds]
sooraj has quit [Ping timeout: 250 seconds]
banisterfiend has quit [Quit: Computer has gone to sleep.]
elia has quit [Quit: Computer has gone to sleep.]
elia has joined #ruby-lang
RickHull1 has quit [Quit: Leaving.]
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
banisterfiend has joined #ruby-lang
apeiros has quit [Ping timeout: 240 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
diegoviola has quit [Ping timeout: 256 seconds]
ykk` has joined #ruby-lang
ykk` has quit [Client Quit]
Oak has quit [Quit: Later guys... :) (me liking http://hexchat.github.io/ very much)]
richardburton has quit [Quit: Leaving.]
cads has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
manoj9788 has quit [Ping timeout: 250 seconds]
elia has joined #ruby-lang
mbj_ is now known as mbj
ykk` has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
schaerli has joined #ruby-lang
lun__ has quit [Remote host closed the connection]
symm- has joined #ruby-lang
lun__ has joined #ruby-lang
qba73 has joined #ruby-lang
jbsan has quit [Quit: jbsan]
apeiros has joined #ruby-lang
banisterfiend has quit [Quit: Computer has gone to sleep.]
rue_XIV has quit [Remote host closed the connection]
rue has joined #ruby-lang
lun__ has quit [Ping timeout: 264 seconds]
banisterfiend has joined #ruby-lang
rue_XIV has joined #ruby-lang
rue has quit [Remote host closed the connection]
hackeron has joined #ruby-lang
alexju has joined #ruby-lang
schaerli has quit [Remote host closed the connection]
schaerli has joined #ruby-lang
JoshuaPaling has quit [Quit: Textual IRC Client: www.textualapp.com]
cored has quit [Ping timeout: 264 seconds]
schaerli has quit [Ping timeout: 256 seconds]
jbsan has joined #ruby-lang
banisterfiend has quit [Quit: Computer has gone to sleep.]
lun__ has joined #ruby-lang
alexju_ has joined #ruby-lang
gjaldon has joined #ruby-lang
jbsan has quit [Client Quit]
alexju has quit [Read error: Operation timed out]
lfox has joined #ruby-lang
jbsan has joined #ruby-lang
tharindu has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
Forgetful_Lion has joined #ruby-lang
elia has joined #ruby-lang
alexju_ has quit [Remote host closed the connection]
dRbiG has quit [Ping timeout: 240 seconds]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
chinno998 has joined #ruby-lang
d2biG has joined #ruby-lang
chinno998 has quit [Max SendQ exceeded]
alexju has joined #ruby-lang
mclee has quit [Ping timeout: 240 seconds]
Forgetful_Lion has joined #ruby-lang
mclee has joined #ruby-lang
zeusmns has quit [Ping timeout: 240 seconds]
chinno998 has joined #ruby-lang
jbsan has quit [Quit: jbsan]
tharindu has quit [Ping timeout: 245 seconds]
chinno998 has left #ruby-lang [#ruby-lang]
zeusmns has joined #ruby-lang
cads has quit [Read error: Operation timed out]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
banisterfiend has joined #ruby-lang
symm- has quit [Ping timeout: 264 seconds]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
hashkey_ has joined #ruby-lang
hashkey_ is now known as Guest68946
apeiros has quit [Remote host closed the connection]
elia has quit [Quit: Computer has gone to sleep.]
hashkey has quit [Ping timeout: 264 seconds]
elia has joined #ruby-lang
metus_violarium has quit [Quit: Konversation terminated!]
elia has quit [Client Quit]
tbuehlmann has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
bastilian has joined #ruby-lang
sleepy_keita has joined #ruby-lang
elia has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
jonathanmarvens has quit [Remote host closed the connection]
Forgetful_Lion has joined #ruby-lang
ruby-lang-hamza has joined #ruby-lang
MaddinXx has quit [Remote host closed the connection]
<ykk`> good morning
<ledestin> good night
<ykk`> =(
<ykk`> other side of the world?
<ledestin> antipodes we are
<ledestin> down under
<ykk`> coo
<ykk`> it's supposed to be beautiful there
<ledestin> it is. but the spring is disappointing in that there's little to smell
<ledestin> weird trees and plants, expect for camellia, they suck
<ledestin> daisies have no smell :(
ruby-lang-hamza has quit [Ping timeout: 250 seconds]
schaerli has joined #ruby-lang
<ykk`> well better then nyc
<ykk`> some days the air pollution is reminiscent of…..
<ykk`> death?
<ykk`> a reminder that our planet is becoming an enormous garbage dumpster?
Elico1 has quit [Quit: Elico1]
<ykk`> i'll take daisies any day tyvm
<ykk`> haha at the end of the Nokogiri::XML class it says "XML is like violence — if it doesn’t solve your problems, you are not using enough of it"
Elico has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
pleirosei has joined #ruby-lang
apeiros has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
jbsan has joined #ruby-lang
Elico has quit [Ping timeout: 260 seconds]
Elico has joined #ruby-lang
banisterfiend has quit [Quit: Computer has gone to sleep.]
jbsan has quit [Ping timeout: 251 seconds]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Tearan has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
qba73 has quit [Remote host closed the connection]
cheddar_bot has joined #ruby-lang
cheddar_bot has quit [Remote host closed the connection]
nisstyre has quit [Remote host closed the connection]
Oak has joined #ruby-lang
alekst has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
alekst has quit [Client Quit]
tonni has quit [Remote host closed the connection]
yxhuvud has quit [Quit: Nettalk6 - www.ntalk.de]
yxhuvud has joined #ruby-lang
yxhuvud has quit [Client Quit]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
yxhuvud2 has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
yxhuvud2 has quit [Read error: Connection reset by peer]
s0ber has quit [Remote host closed the connection]
s0ber has joined #ruby-lang
yxhuvud has joined #ruby-lang
kenta_ has joined #ruby-lang
kgrz has joined #ruby-lang
tkuchiki has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
banisterfiend has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
spike|spiegel has quit [Quit: WeeChat 0.4.1]
Forgetful_Lion has joined #ruby-lang
mdedetrich has quit [Quit: Computer has gone to sleep.]
ledestin has quit [Quit: ledestin]
spike|spiegel has joined #ruby-lang
Nss has quit [Ping timeout: 246 seconds]
elia has joined #ruby-lang
skade has joined #ruby-lang
gix has quit [Ping timeout: 246 seconds]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
gix has joined #ruby-lang
burge has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
kgrz has quit [Remote host closed the connection]
burge has quit [Client Quit]
yxhuvud has quit [Quit: Nettalk6 - www.ntalk.de]
nisstyre has joined #ruby-lang
banisterfiend has quit [Quit: Computer has gone to sleep.]
tonni has joined #ruby-lang
mbj has quit [Ping timeout: 246 seconds]
jbsan has joined #ruby-lang
jbsan has quit [Read error: Operation timed out]
Squarepy has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
rippa has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
tonni has quit [Read error: Connection reset by peer]
nathanstitt has joined #ruby-lang
omninonsense has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
hramrach has quit [Ping timeout: 240 seconds]
Forgetful_Lion has joined #ruby-lang
nofxx has joined #ruby-lang
tonni has joined #ruby-lang
grough has quit []
hramrach has joined #ruby-lang
jxie has joined #ruby-lang
jonathanmarvens has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
banisterfiend has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
toretore has joined #ruby-lang
_whitelogger has joined #ruby-lang
hashkey has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
<ykk`> yorick are you around?
jithu has quit [Quit: Mother, did it need to be so high?]
bzalasky has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
bzalasky has quit [Ping timeout: 264 seconds]
Oak has quit [Quit: Later guys... :) (me liking http://hexchat.github.io/ very much)]
lun__ has quit [Remote host closed the connection]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
eponymi has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
tomzx_mac has joined #ruby-lang
eponymi has quit [Read error: No route to host]
eponymi has joined #ruby-lang
kek has joined #ruby-lang
retro|cz has quit [Ping timeout: 240 seconds]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
hashkey has quit [Quit: Leaving]
pleirosei has quit [Quit: Leaving]
captain_chen has joined #ruby-lang
GaelanAintAround is now known as Gaelan
eponymi has quit [Quit: Colloquy for iPhone - http://colloquy.mobi]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
dmitrykorotkov__ has joined #ruby-lang
dmitrykorotkov has quit [Ping timeout: 240 seconds]
wallerdev has joined #ruby-lang
Bosox20051 has quit [Quit: Leaving]
Gaelan is now known as GaelanAintAround
kek has quit [Remote host closed the connection]
jonathanmarvens has quit [Remote host closed the connection]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
symm- has joined #ruby-lang
tylersmith has joined #ruby-lang
Zerogrifter has joined #ruby-lang
GaelanAintAround is now known as Gaelan
yxhuvud has joined #ruby-lang
tonni has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
<yorickpeterse> pong
tonni has quit [Ping timeout: 264 seconds]
jbsan has joined #ruby-lang
postmodern has quit [Quit: Leaving]
jbsan has quit [Client Quit]
richardburton has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
shinnya has quit [Ping timeout: 245 seconds]
mbj has quit [Quit: leaving]
ykk` has quit [Quit: ykk`]
nertzy has joined #ruby-lang
nisstyre has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
sevvie has joined #ruby-lang
Coincidental has joined #ruby-lang
adambeynon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
deweichen has joined #ruby-lang
lfox has quit [Quit: ZZZzzz…]
yxhuvud has quit [Remote host closed the connection]
nertzy has quit [Quit: This computer has gone to sleep]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
lfox has joined #ruby-lang
yxhuvud has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
gjaldon has quit [Remote host closed the connection]
richardburton has quit [Quit: Leaving.]
richardburton has joined #ruby-lang
yxhuvud has quit [Quit: Leaving]
schaerli has quit [Remote host closed the connection]
schaerli has joined #ruby-lang
schaerli has quit [Read error: Connection reset by peer]
schaerli has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
jithu has joined #ruby-lang
nisstyre has quit [Quit: Leaving]
yxhuvud has joined #ruby-lang
iliketurtles has joined #ruby-lang
Elico has quit [Read error: Connection reset by peer]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
bzalasky has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
benanne has quit [Quit: kbai]
Elico has joined #ruby-lang
nofxx has quit [Ping timeout: 252 seconds]
schaerli has quit [Remote host closed the connection]
schaerli has joined #ruby-lang
richardburton has quit [Quit: Leaving.]
schaerli has quit [Ping timeout: 252 seconds]
bzalasky has quit [Remote host closed the connection]
nhmood_ has quit [Quit: leaving]
bzalasky has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
bzalasky has quit [Read error: Connection reset by peer]
Elico has quit [Ping timeout: 252 seconds]
nhmood has joined #ruby-lang
bzalasky has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
malev has joined #ruby-lang
Elico has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
enebo has joined #ruby-lang
mistym has joined #ruby-lang
enebo has quit [Client Quit]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
bzalasky has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
Naeblis has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
<Naeblis> How can I include other files in Ruby? load "filename.rb" seems to work but require "filename" gives me a LoadError
<Naeblis> (ruby 2.0.0)
Forgetful_Lion has joined #ruby-lang
deweichen has left #ruby-lang [#ruby-lang]
gazzik has joined #ruby-lang
kek has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
workmad3 has quit [Ping timeout: 240 seconds]
<yorickpeterse> . is no longer in the load path
<yorickpeterse> so you need `require './filename'`
<yorickpeterse> or use require_relative
<Naeblis> yorickpeterse: got it
kalesage has joined #ruby-lang
brianpWins has joined #ruby-lang
mbj has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
jbsan has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
<apeiros> yorickpeterse: uh? I don't think require './foo' works
Forgetful_Lion has joined #ruby-lang
<Tearan> Gah! I hate it when I can't get my tests working.
malev has quit [Remote host closed the connection]
<yorickpeterse> apeiros: it does
<apeiros> waaah!
<Tearan> *nods nods* it does
<apeiros> indeed it does. I'm appalled.
<Tearan> why? It's a feature
kek has quit [Remote host closed the connection]
<yorickpeterse> apeiros: remember that require uses LOAD_PATH and/or the full file path
<yorickpeterse> so require '../derp' also works
Forgetful_Lion has quit [Ping timeout: 246 seconds]
bfleischer has joined #ruby-lang
<apeiros> "the full file path" is equivalent to "relative to .", which is what was removed from $LOAD_PATH in the first place. it may now be a bit more explicit but I find it rather inconsistent.
jithu has quit [Quit: Mother, did it need to be so high?]
<apeiros> (except for absolute paths, which neither './foo' nor '../foo' are)
Forgetful_Lion has joined #ruby-lang
<Tearan> *ear dribble*
Tearan has left #ruby-lang [#ruby-lang]
Tearan has joined #ruby-lang
RickHull1 has joined #ruby-lang
Barrin6 has joined #ruby-lang
<Barrin6> could anyone help me here on this one? https://gist.github.com/Chuongv/6789039f5e8764f15a59
Forgetful_Lion has quit [Ping timeout: 246 seconds]
kalesage has quit [Quit: ThrashIRC v2.9 sic populo comunicated]
Forgetful_Lion has joined #ruby-lang
<chris2> Barrin6: to_i or to_f
<chris2> and indent properly
<chris2> actually use a regexp or something to check for number...
<Barrin6> thank you chris2
<Barrin6> that to_f is awesome
<Barrin6> thank you
<chris2> note that it is 0.0 for invalid strings
<chris2> you could use Float(str) and rescue the exception
<apeiros> Float(val) will raise with invalid input
Forgetful_Lion has quit [Ping timeout: 246 seconds]
richardburton has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
<Barrin6> so pot=0.0 would mean either the user inputted a string or 0.0
<Barrin6> hmm
workmad3 has joined #ruby-lang
<Barrin6> might be better to do a method
<Barrin6> should I be using tab or two spaces?
<chris2> two spaces
<Barrin6> probably need to configure tab in notepad++
<Barrin6> to make it wo spaces
<Barrin6> two* spaces
<chris2> and elsif/else in the depth of if
<Barrin6> awesp,e
gazzik has quit [Read error: Connection reset by peer]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
<eam> I believe I've found a bug in IO.popen involving signals - not quite sure where to look
iliketurtles has quit [Quit: zzzzz…..]
lfox has quit [Quit: ZZZzzz…]
<eam> when called with a block it appears to deadlock in a signal handler that traps TERM
Forgetful_Lion has joined #ruby-lang
<eam> I'm not quite sure where in the ruby internals the signal handler comes from
lfox has joined #ruby-lang
<eam> I have some simple code which can reproduce
kstuart has quit [Quit: kstuart]
hhatch has joined #ruby-lang
zmike has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
zmike has quit [Client Quit]
Forgetful_Lion has joined #ruby-lang
gazzik has joined #ruby-lang
amerine has joined #ruby-lang
eponymi has joined #ruby-lang
jithu has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 246 seconds]
arooni-mobile has joined #ruby-lang
arooni-mobile__ has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
nathanstitt has joined #ruby-lang
lsegal has joined #ruby-lang
arooni-mobile__ has left #ruby-lang [#ruby-lang]
arooni has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
jithu has quit [Quit: Mother, did it need to be so high?]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
richardburton has quit [Quit: Leaving.]
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
eponymi has quit [Quit: Colloquy for iPhone - http://colloquy.mobi]
brianpWins has joined #ruby-lang
<yxhuvud> hmm. Demon trident of poison at d9. is it worth switching from war axe ?
<yxhuvud> nm, wrong channel :)
mac___ has joined #ruby-lang
Squarepy has quit [Quit: Leaving]
<captain_chen> lol
<captain_chen> There's a d&d irc on here?
eponymi_ has joined #ruby-lang
<omninonsense> captain_chen: I can't stop giggling at his slip
<captain_chen> omninonsense: at least it wasn't erp
<captain_chen> that would have been more awkward
sevvie has quit [Ping timeout: 256 seconds]
Gaelan is now known as GaelanAintAround
Forgetful_Lion has quit [Ping timeout: 246 seconds]
<omninonsense> What's erp? Does it stand for what I think it stands???!!
Forgetful_Lion has joined #ruby-lang
fijimunkii has joined #ruby-lang
<captain_chen> aka cybering
<omninonsense> captain_chen: Yep... Just as I thought. erp is short for "erotic roleplay," I guess?
mistym has quit [Ping timeout: 240 seconds]
metus_violarium has joined #ruby-lang
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<captain_chen> D&D huh? Maybe I'll check it out later.
lsegal has quit [Read error: Connection reset by peer]
lsegal has joined #ruby-lang
<captain_chen> Quick question: index = Hash.new { |term, id| index[id] = [] } is a hash that is pointing to an array correct?
grough has joined #ruby-lang
<omninonsense> I'm not sure what that code does... It should probably looks like: Hash.new { |term, id| term[id] = [] }
Forgetful_Lion has quit [Ping timeout: 246 seconds]
<omninonsense> It will invoke the block each time you try to access a hash entry that doesn't exist (it uses the block to generate the default value)
<captain_chen> So the default is an empty array?
eponymi_ is now known as eponymi
<omninonsense> Yes. Also "term" is in fact the hash object itself inside the block.
Forgetful_Lion has joined #ruby-lang
<omninonsense> But, not just *a* empty array. It's a new empty array. If you used Hash.new([]), all objects would use the same object (all missing hash entries would have the same object_id)
<captain_chen> Right, right. Thanks.
<captain_chen> I'm fairly close to my goal now.
<captain_chen> I'm just now sure how I would shove in these values
<captain_chen> Into my hash data structure.
<omninonsense> a = Hash.new [] a[:x].object_id #=> 23038200 a[:y].object_id #=> 23038200
gazzik has quit [Remote host closed the connection]
<omninonsense> (it all came out as a single line for me, not sure if my client cocked up)
<omninonsense> Doing the reverse index thing?
<captain_chen> Yeah
<captain_chen> I have an index which has terms pointing to IDs
<omninonsense> Hmm, I think I might've written a tiny example the other day. Let me find it!
Forgetful_Lion has quit [Ping timeout: 246 seconds]
Forgetful_Lion has joined #ruby-lang
<captain_chen> Yeah that's what I have currently, I just need to have more things like term frequency, the title of the document in which the term appears in and the abstract.
tomzx_mac has quit [Ping timeout: 246 seconds]
<omninonsense> whitequark: Oh! Congratulations on the release! :D
<captain_chen> But can it make my breakfast for me?
<omninonsense> Hmm, can you give me an example hash of what you need?
Xzyx987X has quit [Quit: Leaving]
<captain_chen> Here's what I have right now
<captain_chen> {"algebraic"=>[1,2], "language"=>[1,2] ...} where it shows the document IDs of where the terms appear
<captain_chen> I guess what I need would look like: "term" => doc_id, title, abstract
schaerli has joined #ruby-lang
Xzyx987X has joined #ruby-lang
mac___ has quit [Read error: Connection reset by peer]
<omninonsense> Hmm, is something like this good, or would an array suffice?: https://gist.github.com/anonymous/569c5cf824f64597ecee
mac___ has joined #ruby-lang
ledestin has joined #ruby-lang
arooni-mobile has quit [Quit: Leaving]
mac___ has quit [Remote host closed the connection]
<captain_chen> As long as it works, I'm not really complaining.
mac___ has joined #ruby-lang
<omninonsense> Do you have the title, document ID, and the abstract stored somewhere?
<captain_chen> Yeah
<omninonsense> Can you share what you have so far as a gist?
<omninonsense> or pastebin, whatever you prefer
mbj has quit [Ping timeout: 245 seconds]
mac___ has quit [Ping timeout: 240 seconds]
qba73 has quit [Remote host closed the connection]
Squarepy has joined #ruby-lang
nofxx has joined #ruby-lang
<captain_chen> Give me a sec.
schaerli has quit [Remote host closed the connection]
adambeynon has joined #ruby-lang
sevvie has joined #ruby-lang
schaerli has joined #ruby-lang
schaerli has quit [Read error: Operation timed out]
mistym has joined #ruby-lang
sevvie has quit [Ping timeout: 245 seconds]
<omninonsense> Hmm, I have just quickly scanned most of it, so I might be wrong, but I think you can do: index[token] += [ [doc_id.to_i, title, abstract] ]
<omninonsense> instead of index[token] << doc_id.to_i
<omninonsense> Or, just
<omninonsense> index[token] << [doc_id.to_i, title, abstract]
richardburton has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
<captain_chen> Alright I'll give that a try.
<omninonsense> I think << might be even a bit better performance-wise, since it's an alias for Array#push
jarm has joined #ruby-lang
<omninonsense> where as += on an array might create an third array (let me check)
asahi has joined #ruby-lang
<omninonsense> Yeep! It creates a new array!
flip_digits has joined #ruby-lang
<omninonsense> Array#push does not, though :)
bzalasky has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
<workmad3> omninonsense: there is a minor difference between << and .push ;)
<workmad3> omninonsense: 'ary.push("lots", "of", "stuff", "to", "add")'
bzalasky has quit [Remote host closed the connection]
richardburton has quit [Ping timeout: 256 seconds]
bzalasky has joined #ruby-lang
<omninonsense> Oh, indded. Array#push is called rb_ary_push_m inside MRI source
qba73 has joined #ruby-lang
jarm has quit [Ping timeout: 260 seconds]
MrZYX has joined #ruby-lang
<captain_chen> Ah, that works. Thanks.
<omninonsense> You're welcome!
bzalasky has quit [Ping timeout: 264 seconds]
felipec has joined #ruby-lang
<felipec> any developers around can explain why the patch to fix strptime() is not applied?
tomzx_mac has joined #ruby-lang
<whitequark> felipec: try #ruby-core
retro|cz has joined #ruby-lang
<felipec> whitequark: thanks
sevvie has joined #ruby-lang
workmad3 has quit [Ping timeout: 245 seconds]
adambeynon has quit [Quit: Textual IRC Client: www.textualapp.com]
sevvie has quit [Ping timeout: 240 seconds]
tonni has joined #ruby-lang
saarinen has joined #ruby-lang
Guest66192 has quit [Ping timeout: 240 seconds]
VTLob has quit [Quit: VTLob]
skade has joined #ruby-lang
omninonsense_ has joined #ruby-lang
omninonsense_ has quit [Remote host closed the connection]
Guest66192 has joined #ruby-lang
omninonsense has quit [Ping timeout: 264 seconds]
nofxx has quit [Ping timeout: 240 seconds]
dhruvasagar has joined #ruby-lang
<captain_chen> Huh
saarinen has quit [Read error: Connection reset by peer]
<captain_chen> How would I count the number of word appearances? Increment and pass it in during the hash update?
saarinen has joined #ruby-lang
MaddinXx has joined #ruby-lang
metus_violarium has quit [Quit: Konversation terminated!]
tonni has quit [Remote host closed the connection]
GaelanAintAround is now known as Gaelan
nofxx has joined #ruby-lang
foucist has joined #ruby-lang
<foucist> how would you guys do this in a more dry way? https://gist.github.com/foucist/03520f09e64f700d848f
saarinen has quit [Quit: saarinen]
sevvie has joined #ruby-lang
mac___ has joined #ruby-lang
saarinen has joined #ruby-lang
jarm has joined #ruby-lang
<foucist> i mean i'm basically repeating the same bit of code for hash[key].each and hash[key][key2] each
amerine has quit [Quit: Computer has gone to sleep.]
foucist has quit [Quit: gtg]
sevvie has quit [Ping timeout: 252 seconds]
richardburton has joined #ruby-lang
m6n has joined #ruby-lang
saarinen has quit [Quit: saarinen]
dhruvasagar has quit [Ping timeout: 264 seconds]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
richardburton has quit [Ping timeout: 256 seconds]
mac___ has quit [Remote host closed the connection]
mac___ has joined #ruby-lang
tonni has joined #ruby-lang
relix has joined #ruby-lang
elia has joined #ruby-lang
asahi has quit [Quit: Leaving.]
tonni has quit [Remote host closed the connection]
<Barrin6> yess just finished writing my first ruby program
<Barrin6> greatest feeling ever
tomzx_mac has quit [Ping timeout: 245 seconds]
MrZYX is now known as MrZYX|off
sevvie has joined #ruby-lang
kstuart has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<captain_chen> lol, that's cool.
toretore has quit [Quit: Leaving]
stamina has quit [Ping timeout: 264 seconds]
jiuweigui has quit [Quit: iQuit!]
workmad3 has joined #ruby-lang
saarinen has joined #ruby-lang
cads has joined #ruby-lang
bzalasky has joined #ruby-lang
mdedetrich has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
<captain_chen> Anyone happen to know how to have a word counter hash inside another hash that returns the right value?
yfeldblum has joined #ruby-lang
sepp2k1 has joined #ruby-lang
eponymi has quit [Ping timeout: 260 seconds]
sepp2k has quit [Ping timeout: 256 seconds]
richardburton has joined #ruby-lang
eponymi has joined #ruby-lang
eponymi has quit [Client Quit]
mistym has quit [Remote host closed the connection]
saarinen has quit [Quit: saarinen]
richardburton has quit [Ping timeout: 245 seconds]
apeiros has quit [Remote host closed the connection]
schaerli has joined #ruby-lang
apeiros has joined #ruby-lang
schaerli has quit [Remote host closed the connection]
schaerli has joined #ruby-lang
MaddinXx has quit [Remote host closed the connection]
benanne has joined #ruby-lang
schaerli has quit [Ping timeout: 240 seconds]
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
Elico has quit [Ping timeout: 264 seconds]
bzalasky has quit [Ping timeout: 264 seconds]
lfox has quit [Quit: ZZZzzz…]
workmad3 has quit [Ping timeout: 240 seconds]
x0f has quit [Read error: Operation timed out]
tonni has joined #ruby-lang
Elico has joined #ruby-lang
hhatch has quit [Ping timeout: 245 seconds]
tonni has quit [Ping timeout: 264 seconds]
x0f has joined #ruby-lang
nisstyre has joined #ruby-lang
skade has quit [Quit: Textual IRC Client: www.textualapp.com]
lfox has joined #ruby-lang
bastilian has quit [Ping timeout: 245 seconds]
mdedetrich has quit [Quit: Computer has gone to sleep.]
elia has joined #ruby-lang
eponymi has joined #ruby-lang
cads has quit [Read error: Operation timed out]
kek has joined #ruby-lang
eponymi has quit [Quit: Colloquy for iPhone - http://colloquy.mobi]
richardburton has joined #ruby-lang