paulroth3d / jupyter-ijavascript-utils

Utility library for working with iJavaScript - a Jupyter Kernel
1 stars 0 forks source link

Create a 1d to 2d parser #25

Closed darkbluestudios closed 1 year ago

darkbluestudios commented 1 year ago

I have a list like this:

["H2","H2","LI","LI","LI","LI","H2","H4","LI","H4","LI","LI","LI","LI","LI","H2","H4","LI","H4","LI","LI","LI","LI","LI","LI","LI","LI","H2","H4","LI","LI","H4","LI","LI","LI","LI","LI","LI","LI","LI","LI","LI","LI","H2","H4","LI","LI","H4","LI","LI","LI","H2","H4","LI","H4","LI","LI","LI","LI","LI","LI","LI","H2","H4","LI","H4","LI","LI","LI","LI","LI","LI","LI","LI","LI","H2","H4","LI"]

h2 has a text value L4 should inherit the text value from the previous h2 LI should inherit the text value from both the previous h4 and h2

(its a hierarchy)

darkbluestudios commented 1 year ago

For example:

(index) h2 h4 text link
0 'Part 0: Welcome to the Course!' null 'Section 1....urse!' 'https://ww...teves'
1 'Part 0: Welcome to the Course!' null 'Deep Learn...1021)' 'https://sd...Z.zip'
2 'Part 0: Welcome to the Course!' null 'Google Col...tions' 'https://sd...s.zip'
3 'Part 0: Welcome to the Course!' null 'Updated code' 'https://sd...s.zip'
4 'Part 1: Artificial Neural Networks (ANN)' 'Datasets & Templates:' 'Artificial...works' 'https://sd...s.zip'
5 'Part 1: Artificial Neural Networks (ANN)' 'Additional Reading:' 'Yann LeCun...kProp' 'http://yan...b.pdf'
6 'Part 1: Artificial Neural Networks (ANN)' 'Additional Reading:' 'By Xavier ...works' 'http://jml...a.pdf'
7 'Part 1: Artificial Neural Networks (ANN)' 'Additional Reading:' 'CrossValid...tions' 'http://sta...tions'
8 'Part 1: Artificial Neural Networks (ANN)' 'Additional Reading:' 'Andrew Tra...cent)' 'https://ia...art2/'
9 'Part 1: Artificial Neural Networks (ANN)' 'Additional Reading:' 'Michael Ni...rning' 'http://neu....html'
10 'Part 2: Convolutional Neural Networks (CNN)' 'Datasets & Templates:' 'Convolutio...works' 'https://sd...s.zip'
11 'Part 2: Convolutional Neural Networks (CNN)' 'Additional Reading:' 'Yann LeCun...ition' 'http://yan...a.pdf'
12 'Part 2: Convolutional Neural Networks (CNN)' 'Additional Reading:' 'Jianxin Wu...works' 'http://cs....N.pdf'
13 'Part 2: Convolutional Neural Networks (CNN)' 'Additional Reading:' 'C.-C. Jay ...Model' 'https://ar...2.pdf'
14 'Part 2: Convolutional Neural Networks (CNN)' 'Additional Reading:' 'Kaiming He...ation' 'https://ar...2.pdf'
15 'Part 2: Convolutional Neural Networks (CNN)' 'Additional Reading:' 'Dominik Sc...ition' 'http://ais...l.pdf'
16 'Part 2: Convolutional Neural Networks (CNN)' 'Additional Reading:' 'Adit Deshp...rt 3)' 'https://ad....html'
17 'Part 2: Convolutional Neural Networks (CNN)' 'Additional Reading:' 'Rob DiPiet... Loss' 'https://rd...loss/'
18 'Part 2: Convolutional Neural Networks (CNN)' 'Additional Reading:' 'Peter Roel...zzo 2' 'http://pet...zo02/'
19 'Part 3: Recurrent Neural Networks (RNN)' 'Datasets & Templates:' 'Recurrent-...works' 'https://sd...s.zip'
20 'Part 3: Recurrent Neural Networks (RNN)' 'Datasets & Templates:' 'Homework-C...lenge' 'https://sd...e.zip'
21 'Part 3: Recurrent Neural Networks (RNN)' 'Additional Reading:' 'Oscar Shar...pring' 'https://ar...ving/'
paulroth3d commented 1 year ago

capturing data is an interesting problem. there is a large tree of nested html elements, and we only care about a few of them.

The initial problem came up as a question about how can we handle some form of inheritance by child to parent. If we know the parent's title is 'Recurrent Neural Networks', could we make that available to the children when they are parsed.

One approach is to keep the depth (distance so either root or some element) that is already in the page when parsing

another is to use some sort of finite state machine, like xstate

paulroth3d commented 1 year ago

Essentially resolved with 1.33 like with augmentInherit https://jupyter-ijavascript-utils.onrender.com/module-object.html#.augmentInherit

but the example isn't clear

the way to resolve this is to have a list from the parent, and then child and have the child inherit the value of the parent so when a new parent comes in the next set of children inherit from that new parent.

note that only properties that are considered 'undefined' are considered overwritable.