# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import chemdataextractor as cde
import json

# ### Workthrough of http://chemdataextractor.org/docs/ tutorial
#
# Using DOI: 10.1021/cm300416y

f = open('/Users/wesleytatum/Google Drive/Luscombe group/Projects/eScience Incubator/test_HTML_ACS/ameen_7b18044.html', 'rb')
doc = cde.Document.from_file(f)

doc.elements

print (len(doc))

doc.records.serialize()

print (len(doc.paragraphs))

print (doc.paragraphs[1])

for i in range(len(doc.paragraphs)):
    para = doc.paragraphs[i]
    para.sentences

print (doc.paragraphs[1].sentences)

for i in range(len(doc.paragraphs)):
    para = doc.paragraphs[i]
    para.tokens

print (doc.paragraphs[1].tokens)

for i in range(len(doc.paragraphs)):
    for j in range(len(doc.paragraphs[i].sentences)):
        s = doc.paragraphs[i].sentences[j]
        s.pos_tagged_tokens

doc.cems

s = doc.paragraphs[35].sentences[0].tokens[0]
print (s.lex.normalized, s.lex.is_hyphenated, s.lex.cluster)

doc.paragraphs[10].abbreviation_definitions

# +
print (doc.tables[1].records[0])


# -

print (doc.tables[0])

doc.cems

doc.records

doc.records.serialize()

doc.records.quantum_yields



StarcoderdataJupyterScriptsDedupFiltered