Skip to content

Update nlp.py #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scratch/nlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def fix_unicode(text: str) -> str:
html = requests.get(url).text
soup = BeautifulSoup(html, 'html5lib')

content = soup.find("div", "article-body") # find article-body div
content = soup.find("div", "main-post-radar-content") # find main-post-radar-content div
regex = r"[\w']+|[\.]" # matches a word or a period

document = []
Expand Down Expand Up @@ -643,7 +643,7 @@ def text_size(total: int) -> float:
companies = list({b.text
for b in soup("b")
if "h4" in b.get("class", ())})
assert len(companies) == 101
assert len(companies) == 102

vocab = Vocabulary([c for company in companies for c in company])

Expand Down Expand Up @@ -721,4 +721,4 @@ def generate(seed: str = START, max_len: int = 50) -> str:
if epoch == 200:
optimizer.lr *= 0.1

if __name__ == "__main__": main()
if __name__ == "__main__": main()