workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
exactly
2018-01-18T16:55:01.000989
Floy
pythondev_help_Floy_2018-01-18T16:55:01.000989
1,516,294,501.000989
29,824
pythondev
help
the difficult part is there is a `unique` constraint in SQL
2018-01-18T16:55:27.000904
Floy
pythondev_help_Floy_2018-01-18T16:55:27.000904
1,516,294,527.000904
29,825
pythondev
help
but its implemented to mean that the value for that column is unique to the entire table
2018-01-18T16:55:43.001097
Floy
pythondev_help_Floy_2018-01-18T16:55:43.001097
1,516,294,543.001097
29,826
pythondev
help
indeed, you kind of want a composite uniqueness
2018-01-18T16:55:57.000185
Stefan
pythondev_help_Stefan_2018-01-18T16:55:57.000185
1,516,294,557.000185
29,827
pythondev
help
thats why you’d have to use whatever DB you’re using to make such a composite unique constraint
2018-01-18T16:56:06.000285
Floy
pythondev_help_Floy_2018-01-18T16:56:06.000285
1,516,294,566.000285
29,828
pythondev
help
:confused: not with sqlalchemy?
2018-01-18T16:56:17.000394
Stefan
pythondev_help_Stefan_2018-01-18T16:56:17.000394
1,516,294,577.000394
29,829
pythondev
help
I think you’re misunderstanding the role between the two
2018-01-18T16:56:36.000123
Floy
pythondev_help_Floy_2018-01-18T16:56:36.000123
1,516,294,596.000123
29,830
pythondev
help
right now, the goal is to develop a schema that fits your data
2018-01-18T16:56:55.000490
Floy
pythondev_help_Floy_2018-01-18T16:56:55.000490
1,516,294,615.00049
29,831
pythondev
help
just a quick check: when we use a foreign key to an id... does that make us be able to refer to the Currency object in "from_currency"? not right? is that why we use `backref`?
2018-01-18T16:57:01.000478
Stefan
pythondev_help_Stefan_2018-01-18T16:57:01.000478
1,516,294,621.000478
29,832
pythondev
help
correct
2018-01-18T16:57:13.000300
Floy
pythondev_help_Floy_2018-01-18T16:57:13.000300
1,516,294,633.0003
29,833
pythondev
help
well I thought that this schema would make enough sense to get started (minus the constraint, but i could live with that detail for now)
2018-01-18T16:57:50.000262
Stefan
pythondev_help_Stefan_2018-01-18T16:57:50.000262
1,516,294,670.000262
29,834
pythondev
help
just that I couldn't get it to work
2018-01-18T16:57:59.000659
Stefan
pythondev_help_Stefan_2018-01-18T16:57:59.000659
1,516,294,679.000659
29,835
pythondev
help
<https://stackoverflow.com/questions/10059345/sqlalchemy-unique-across-multiple-columns>
2018-01-18T16:58:19.000170
Floy
pythondev_help_Floy_2018-01-18T16:58:19.000170
1,516,294,699.00017
29,836
pythondev
help
do I not need a `relationship`?
2018-01-18T17:00:26.000284
Stefan
pythondev_help_Stefan_2018-01-18T17:00:26.000284
1,516,294,826.000284
29,837
pythondev
help
on `class Currency` like `relationship('Pair', backref='left', lazy=True)`
2018-01-18T17:01:04.000877
Stefan
pythondev_help_Stefan_2018-01-18T17:01:04.000877
1,516,294,864.000877
29,838
pythondev
help
<@Floy> could you tell me whats wrong here :slightly_smiling_face: ?
2018-01-18T17:11:08.000042
Stefan
pythondev_help_Stefan_2018-01-18T17:11:08.000042
1,516,295,468.000042
29,839
pythondev
help
I'm commuting home now, sorry
2018-01-18T17:13:17.000452
Floy
pythondev_help_Floy_2018-01-18T17:13:17.000452
1,516,295,597.000452
29,840
pythondev
help
ah no problem :slightly_smiling_face:
2018-01-18T17:14:19.000123
Stefan
pythondev_help_Stefan_2018-01-18T17:14:19.000123
1,516,295,659.000123
29,841
pythondev
help
<@Davina> just saw your last post, thanks man!
2018-01-18T17:25:13.000347
Bella
pythondev_help_Bella_2018-01-18T17:25:13.000347
1,516,296,313.000347
29,842
pythondev
help
<@Stefan> looks like you forgot the code for the relationship in your snippet
2018-01-18T17:32:49.000191
Brande
pythondev_help_Brande_2018-01-18T17:32:49.000191
1,516,296,769.000191
29,843
pythondev
help
Yea i'm thinking it is now working
2018-01-18T17:40:24.000913
Stefan
pythondev_help_Stefan_2018-01-18T17:40:24.000913
1,516,297,224.000913
29,844
pythondev
help
to me it seems a bit silly I have to implement `left_id`... why wouldn't it automagically make this column if we would just define a relationship? to use the primary key of the other table?
2018-01-18T17:41:31.000287
Stefan
pythondev_help_Stefan_2018-01-18T17:41:31.000287
1,516,297,291.000287
29,845
pythondev
help
yup
2018-01-18T17:42:17.000800
Brande
pythondev_help_Brande_2018-01-18T17:42:17.000800
1,516,297,337.0008
29,846
pythondev
help
and for the other question, because how SQL is. you can’t create relationships on something that doesn’t exist, and implicitly creating columns for relationships is yuck
2018-01-18T17:43:05.000777
Brande
pythondev_help_Brande_2018-01-18T17:43:05.000777
1,516,297,385.000777
29,847
pythondev
help
`lazy=True`?
2018-01-18T17:43:26.000631
Stefan
pythondev_help_Stefan_2018-01-18T17:43:26.000631
1,516,297,406.000631
29,848
pythondev
help
I would also like to auto generate some stuff you know
2018-01-18T17:43:53.000502
Stefan
pythondev_help_Stefan_2018-01-18T17:43:53.000502
1,516,297,433.000502
29,849
pythondev
help
maybe pandas can do it
2018-01-18T17:44:08.000676
Stefan
pythondev_help_Stefan_2018-01-18T17:44:08.000676
1,516,297,448.000676
29,850
pythondev
help
`pandas.DataFrame.to_sql`
2018-01-18T17:44:36.001353
Stefan
pythondev_help_Stefan_2018-01-18T17:44:36.001353
1,516,297,476.001353
29,851
pythondev
help
lol
2018-01-18T17:44:38.001431
Stefan
pythondev_help_Stefan_2018-01-18T17:44:38.001431
1,516,297,478.001431
29,852
pythondev
help
db modeling shouldn’t be done with autogenerated fields other than standard conventions like `created_on` `deleted_on` etc
2018-01-18T17:45:06.001087
Brande
pythondev_help_Brande_2018-01-18T17:45:06.001087
1,516,297,506.001087
29,853
pythondev
help
i'd like it to get started though
2018-01-18T17:45:37.000304
Stefan
pythondev_help_Stefan_2018-01-18T17:45:37.000304
1,516,297,537.000304
29,854
pythondev
help
well once you have the model and the implementation in place it’ll be rolling, but good data modeling is a good price to pay up front before it bites you later
2018-01-18T17:54:30.000374
Brande
pythondev_help_Brande_2018-01-18T17:54:30.000374
1,516,298,070.000374
29,855
pythondev
help
I did it :slightly_smiling_face: exchanges, pairs and currencies, with many to many and one to many relations
2018-01-18T18:04:01.000165
Stefan
pythondev_help_Stefan_2018-01-18T18:04:01.000165
1,516,298,641.000165
29,856
pythondev
help
hey all - I’m running into a strange issue involving recursion with a sentence tree data structure.
2018-01-18T19:37:28.000818
Tisa
pythondev_help_Tisa_2018-01-18T19:37:28.000818
1,516,304,248.000818
29,857
pythondev
help
wow that bot is annoying.
2018-01-18T19:37:40.000452
Tisa
pythondev_help_Tisa_2018-01-18T19:37:40.000452
1,516,304,260.000452
29,858
pythondev
help
I have a list of the form `['(', 'S', '(', 'NP', '(', 'Det', 'the', ')', '(', 'N', 'dog', ')', ')', '(', 'VP', '(', 'V', 'barks', ')', ')', '(', 'Adv', 'loudly', ')', ')']` that I’m parsing using a pretty simple recursiv. function to produce a sentence tree object.
2018-01-18T19:39:20.001623
Tisa
pythondev_help_Tisa_2018-01-18T19:39:20.001623
1,516,304,360.001623
29,859
pythondev
help
However, I’m getting bizarre results where the child lists always contain themselves and all other children. It’s as though the stack is “leaking”.
2018-01-18T19:40:22.001298
Tisa
pythondev_help_Tisa_2018-01-18T19:40:22.001298
1,516,304,422.001298
29,860
pythondev
help
This is what the data structure ends up looking like - it’s only supposed to have two layers, the NP layer and its two children: (Det the) and (N dog).
2018-01-18T19:41:37.000611
Tisa
pythondev_help_Tisa_2018-01-18T19:41:37.000611
1,516,304,497.000611
29,861
pythondev
help
Can anyone help me out? I’m really at the end of my rope here.
2018-01-18T19:41:56.000443
Tisa
pythondev_help_Tisa_2018-01-18T19:41:56.000443
1,516,304,516.000443
29,862
pythondev
help
hello? is anyone even here?
2018-01-18T19:46:07.000726
Tisa
pythondev_help_Tisa_2018-01-18T19:46:07.000726
1,516,304,767.000726
29,863
pythondev
help
:wave:
2018-01-18T19:46:47.000853
Kathlyn
pythondev_help_Kathlyn_2018-01-18T19:46:47.000853
1,516,304,807.000853
29,864
pythondev
help
hi
2018-01-18T19:47:51.000418
Tisa
pythondev_help_Tisa_2018-01-18T19:47:51.000418
1,516,304,871.000418
29,865
pythondev
help
so uh, any insights as to why recurson (intentionally misspelling it to avoid the bot) would cause this weird stuff?
2018-01-18T19:48:56.000178
Tisa
pythondev_help_Tisa_2018-01-18T19:48:56.000178
1,516,304,936.000178
29,866
pythondev
help
<@Tisa> it looks to me like you shouldn't do the internal part like that (double "(")
2018-01-18T19:54:20.000551
Stefan
pythondev_help_Stefan_2018-01-18T19:54:20.000551
1,516,305,260.000551
29,867
pythondev
help
the “while tokens[j] == ‘(’” part?
2018-01-18T19:54:37.000912
Tisa
pythondev_help_Tisa_2018-01-18T19:54:37.000912
1,516,305,277.000912
29,868
pythondev
help
yea
2018-01-18T19:54:44.000631
Stefan
pythondev_help_Stefan_2018-01-18T19:54:44.000631
1,516,305,284.000631
29,869
pythondev
help
what's the example string?
2018-01-18T19:54:50.000442
Stefan
pythondev_help_Stefan_2018-01-18T19:54:50.000442
1,516,305,290.000442
29,870
pythondev
help
I pasted it above
2018-01-18T19:55:00.000512
Tisa
pythondev_help_Tisa_2018-01-18T19:55:00.000512
1,516,305,300.000512
29,871
pythondev
help
`['(', 'S', '(', 'NP', '(', 'Det', 'the', ')', '(', 'N', 'dog', ')', ')', '(', 'VP', '(', 'V', 'barks', ')', ')', '(', 'Adv', 'loudly', ')', ')']`
2018-01-18T19:55:13.000103
Tisa
pythondev_help_Tisa_2018-01-18T19:55:13.000103
1,516,305,313.000103
29,872
pythondev
help
ah, that looked to me like the parsed representation lol
2018-01-18T19:55:15.000140
Stefan
pythondev_help_Stefan_2018-01-18T19:55:15.000140
1,516,305,315.00014
29,873
pythondev
help
it’s in list form already - so it kind of is.
2018-01-18T19:55:29.000738
Tisa
pythondev_help_Tisa_2018-01-18T19:55:29.000738
1,516,305,329.000738
29,874
pythondev
help
It’s the tokenized form.
2018-01-18T19:55:32.000890
Tisa
pythondev_help_Tisa_2018-01-18T19:55:32.000890
1,516,305,332.00089
29,875
pythondev
help
you could also consider writing it in the iterative way when you get stuck on recursion
2018-01-18T19:55:58.001135
Stefan
pythondev_help_Stefan_2018-01-18T19:55:58.001135
1,516,305,358.001135
29,876
pythondev
help
The problem is, this is for sentence trees. So it’s much easier to write recursively than iteratively…
2018-01-18T19:56:36.000983
Tisa
pythondev_help_Tisa_2018-01-18T19:56:36.000983
1,516,305,396.000983
29,877
pythondev
help
so i think you will want to just handle it case by case rather than looking ahead?
2018-01-18T19:56:42.000243
Stefan
pythondev_help_Stefan_2018-01-18T19:56:42.000243
1,516,305,402.000243
29,878
pythondev
help
How do you mean? From what I understand there are two basic cases: we’re at a leaf node or we’re at an internal node.
2018-01-18T19:57:09.000866
Tisa
pythondev_help_Tisa_2018-01-18T19:57:09.000866
1,516,305,429.000866
29,879
pythondev
help
so don't do anything other than look at the current node
2018-01-18T19:57:16.000399
Stefan
pythondev_help_Stefan_2018-01-18T19:57:16.000399
1,516,305,436.000399
29,880
pythondev
help
Sure, that’d be nice if I could do it. The problem is - I need to add children to the parent node’s “children” member.
2018-01-18T19:58:05.000397
Tisa
pythondev_help_Tisa_2018-01-18T19:58:05.000397
1,516,305,485.000397
29,881
pythondev
help
I suppose I could add them to a list and set the parent’s “children” member to it - but that’s still the same general issue.
2018-01-18T19:58:32.000244
Tisa
pythondev_help_Tisa_2018-01-18T19:58:32.000244
1,516,305,512.000244
29,882
pythondev
help
you need to carry along tree in the algo
2018-01-18T19:58:47.001005
Stefan
pythondev_help_Stefan_2018-01-18T19:58:47.001005
1,516,305,527.001005
29,883
pythondev
help
Why? I’m returning the tree - isn’t that good enough?
2018-01-18T19:59:35.000784
Tisa
pythondev_help_Tisa_2018-01-18T19:59:35.000784
1,516,305,575.000784
29,884
pythondev
help
I feel like I’m missing something obvious here but I don’t know what it is.
2018-01-18T19:59:55.000934
Tisa
pythondev_help_Tisa_2018-01-18T19:59:55.000934
1,516,305,595.000934
29,885
pythondev
help
Do note that this isn’t a standard Python tree - it’s a custom class.
2018-01-18T20:01:42.001421
Tisa
pythondev_help_Tisa_2018-01-18T20:01:42.001421
1,516,305,702.001421
29,886
pythondev
help
you sure you don't want to use spacy :stuck_out_tongue:?
2018-01-18T20:02:05.000087
Stefan
pythondev_help_Stefan_2018-01-18T20:02:05.000087
1,516,305,725.000087
29,887
pythondev
help
I’m using only standard python libs for this - if I could I’d use NLTK and not worry about it.
2018-01-18T20:02:23.000452
Tisa
pythondev_help_Tisa_2018-01-18T20:02:23.000452
1,516,305,743.000452
29,888
pythondev
help
I stole someone's tree algo to create spacy_api TreeView
2018-01-18T20:02:25.001416
Stefan
pythondev_help_Stefan_2018-01-18T20:02:25.001416
1,516,305,745.001416
29,889
pythondev
help
This needs to be a custom class anyways since it’s a *sentence tree* not a normal tree.
2018-01-18T20:02:45.000664
Tisa
pythondev_help_Tisa_2018-01-18T20:02:45.000664
1,516,305,765.000664
29,890
pythondev
help
so the main thing is
2018-01-18T20:03:00.000006
Stefan
pythondev_help_Stefan_2018-01-18T20:03:00.000006
1,516,305,780.000006
29,891
pythondev
help
I laid down the structure for you
2018-01-18T20:03:07.001529
Stefan
pythondev_help_Stefan_2018-01-18T20:03:07.001529
1,516,305,787.001529
29,892
pythondev
help
you just need to make tree be your object
2018-01-18T20:03:16.000010
Stefan
pythondev_help_Stefan_2018-01-18T20:03:16.000010
1,516,305,796.00001
29,893
pythondev
help
and implement `pass`
2018-01-18T20:03:25.001091
Stefan
pythondev_help_Stefan_2018-01-18T20:03:25.001091
1,516,305,805.001091
29,894
pythondev
help
the recursion should be taken care of if im not mistaken
2018-01-18T20:03:32.000966
Stefan
pythondev_help_Stefan_2018-01-18T20:03:32.000966
1,516,305,812.000966
29,895
pythondev
help
OK. And why would we want to do parse tokens=tokens[1:] instead of moving forwards to a new ( symbol?
2018-01-18T20:04:06.001060
Tisa
pythondev_help_Tisa_2018-01-18T20:04:06.001060
1,516,305,846.00106
29,896
pythondev
help
I actually think this is easier done using iteration but that's my feeling
2018-01-18T20:04:46.000669
Stefan
pythondev_help_Stefan_2018-01-18T20:04:46.000669
1,516,305,886.000669
29,897
pythondev
help
well you could, but that's just an optimization
2018-01-18T20:05:03.000151
Stefan
pythondev_help_Stefan_2018-01-18T20:05:03.000151
1,516,305,903.000151
29,898
pythondev
help
OK. I’ll take a look at that code and try to implement it with my class.
2018-01-18T20:05:56.000884
Tisa
pythondev_help_Tisa_2018-01-18T20:05:56.000884
1,516,305,956.000884
29,899
pythondev
help
I feel like you might need to add an extra variable
2018-01-18T20:06:38.000867
Stefan
pythondev_help_Stefan_2018-01-18T20:06:38.000867
1,516,305,998.000867
29,900
pythondev
help
something like a pointer
2018-01-18T20:06:46.000499
Stefan
pythondev_help_Stefan_2018-01-18T20:06:46.000499
1,516,306,006.000499
29,901
pythondev
help
to a current node
2018-01-18T20:06:55.000661
Stefan
pythondev_help_Stefan_2018-01-18T20:06:55.000661
1,516,306,015.000661
29,902
pythondev
help
well actually
2018-01-18T20:07:36.001246
Stefan
pythondev_help_Stefan_2018-01-18T20:07:36.001246
1,516,306,056.001246
29,903
pythondev
help
I highly doubt that’s the case. I’ve implemented something similar before and it definitely didn’t need a node pointer.
2018-01-18T20:07:41.001068
Tisa
pythondev_help_Tisa_2018-01-18T20:07:41.001068
1,516,306,061.001068
29,904
pythondev
help
Might need a “start index” variable but that’s what “start” was supposed to do.
2018-01-18T20:08:14.000558
Tisa
pythondev_help_Tisa_2018-01-18T20:08:14.000558
1,516,306,094.000558
29,905
pythondev
help
ahh, nvm - just using a separate list instead of assigning directly to “children” fixed it for some godforsaken reason
2018-01-18T20:11:16.000345
Tisa
pythondev_help_Tisa_2018-01-18T20:11:16.000345
1,516,306,276.000345
29,906
pythondev
help
this is one messed up structure lol
2018-01-18T20:14:37.001060
Stefan
pythondev_help_Stefan_2018-01-18T20:14:37.001060
1,516,306,477.00106
29,907
pythondev
help
I have no idea what the heck is going on there, for some reason the children member (which is just a simple list) persists through all the instances of the freakin’ object in that recursive function
2018-01-18T20:15:51.000688
Tisa
pythondev_help_Tisa_2018-01-18T20:15:51.000688
1,516,306,551.000688
29,908
pythondev
help
did you do like
2018-01-18T20:16:06.000244
Stefan
pythondev_help_Stefan_2018-01-18T20:16:06.000244
1,516,306,566.000244
29,909
pythondev
help
class A():
2018-01-18T20:16:09.001109
Stefan
pythondev_help_Stefan_2018-01-18T20:16:09.001109
1,516,306,569.001109
29,910
pythondev
help
a = 1
2018-01-18T20:16:13.000478
Stefan
pythondev_help_Stefan_2018-01-18T20:16:13.000478
1,516,306,573.000478
29,911
pythondev
help
ugh
2018-01-18T20:16:17.001418
Stefan
pythondev_help_Stefan_2018-01-18T20:16:17.001418
1,516,306,577.001418
29,912
pythondev
help
I just made a new list and appended to it, then set children to that list
2018-01-18T20:16:28.000474
Tisa
pythondev_help_Tisa_2018-01-18T20:16:28.000474
1,516,306,588.000474
29,913
pythondev
help
class A(): my_list = []
2018-01-18T20:16:30.000511
Stefan
pythondev_help_Stefan_2018-01-18T20:16:30.000511
1,516,306,590.000511
29,914
pythondev
help
and it works now
2018-01-18T20:16:30.000552
Tisa
pythondev_help_Tisa_2018-01-18T20:16:30.000552
1,516,306,590.000552
29,915
pythondev
help
like that it is a class variable
2018-01-18T20:16:37.001456
Stefan
pythondev_help_Stefan_2018-01-18T20:16:37.001456
1,516,306,597.001456
29,916
pythondev
help
so it will "leak" as you call it
2018-01-18T20:16:41.000733
Stefan
pythondev_help_Stefan_2018-01-18T20:16:41.000733
1,516,306,601.000733
29,917
pythondev
help
class A(): def __init__(self): my_list = []
2018-01-18T20:16:54.000949
Stefan
pythondev_help_Stefan_2018-01-18T20:16:54.000949
1,516,306,614.000949
29,918
pythondev
help
then it won't leak
2018-01-18T20:16:57.000791
Stefan
pythondev_help_Stefan_2018-01-18T20:16:57.000791
1,516,306,617.000791
29,919
pythondev
help
I did __init__(self, children=[])
2018-01-18T20:17:17.000842
Tisa
pythondev_help_Tisa_2018-01-18T20:17:17.000842
1,516,306,637.000842
29,920
pythondev
help
could that be it
2018-01-18T20:17:19.000597
Tisa
pythondev_help_Tisa_2018-01-18T20:17:19.000597
1,516,306,639.000597
29,921
pythondev
help
yep
2018-01-18T20:17:21.001559
Garrett
pythondev_help_Garrett_2018-01-18T20:17:21.001559
1,516,306,641.001559
29,922
pythondev
help
yea
2018-01-18T20:17:22.000734
Stefan
pythondev_help_Stefan_2018-01-18T20:17:22.000734
1,516,306,642.000734
29,923