thesaurus.com javascript JSON parsing with demjson, unicode ready

This commit is contained in:
Xevion
2021-03-14 10:02:26 -05:00
parent 1f6f3246ae
commit 696e96e2ad
3 changed files with 106 additions and 0 deletions

57
scraper/word.py Normal file
View File

@@ -0,0 +1,57 @@
from typing import List, Optional
class Word(object):
"""
Describes a word on Thesaurus.com uniquely identified by it's slug/URL.
"""
def __init__(self, entry: str, inflections: Optional[List[str]] = None, variants: Optional[List['WordVariant']] = None,
pronunciation: Optional['Pronunciation'] = None, examples: Optional[List['ExampleSentence']] = None):
self.entry = entry
self.inflections = inflections or []
self.variants = variants or []
self.pronunciation = pronunciation
self.examples = examples or []
@classmethod
def from_raw(cls, data: dict) -> 'Word':
pass
def __repr__(self) -> str:
pass
class WordVariant(object):
def __init__(self) -> None:
pass
@classmethod
def from_raw(cls, data: dict) -> 'WordVariant':
pass
def __repr__(self) -> str:
pass
class Pronunciation(object):
def __init__(self, term: str, definition: str, pos: str, synonyms: List[str], antonyms: List[str], informal: Optional[int],
vulgar: int, note: Optional[str], id: int) -> None:
pass
@classmethod
def from_raw(cls, data: dict) -> 'Pronunciation':
pass
def __repr__(self) -> str:
pass
class ExampleSentence(object):
def __init__(self) -> None:
pass
@classmethod
def from_raw(cls, data: dict) -> 'ExampleSentence':
pass
def __repr__(self) -> str:
pass