Skip to content

Commit

Permalink
can read in all terms
Browse files Browse the repository at this point in the history
  • Loading branch information
togakangaroo committed Sep 20, 2018
1 parent c0281ef commit 39ca091
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ The idea is that this list is optimized for rote memorization - so each definiti
## Contribute

Terms are written in org mode. For now just give a regular pull request. I'll take care of merging for now.

## Future Work


Look at [Glossary Tech](https://glossarytech.com/terms/software_architecture/page2), maybe scrape it

12 changes: 12 additions & 0 deletions generator/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
"csv2anki" = "*"

[dev-packages]

[requires]
python_version = "3.7"
43 changes: 43 additions & 0 deletions generator/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions generator/parse_terms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import re
import csv

def llen(gen):
return sum(1 for _ in gen)

two_col_org_row = re.compile('^\\s*\\|\\s*(.*?)\\s*\\|\\s*(.*?)\\s*\\|\\s*$')
with open(f'../terms.org', 'r') as file:
lines = file.read().splitlines()
extracted_cells = (two_col_org_row.match(l).groups() for l in lines)
term_definitions = (g for g in extracted_cells if len(g) == 2)

with open(f'./test.csv', 'w') as csv_file:
wr = csv.writer(csv_file)
for (term, definition) in term_definitions:
wr.writerow([term, definition])
3 changes: 0 additions & 3 deletions terms.org
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
Look at [[https://glossarytech.com/terms/software_architecture/page2][Glossary Tech]], maybe scrape it


| Tools | Either code or software that is used by developers in running or building software. |
| Framework | Code, typically written by someone else, that can be used to speed up development and provide structure to project code. |
| Library | Code, typically written by someone else, that can be used to provide a specific solution. |
Expand Down

0 comments on commit 39ca091

Please sign in to comment.