Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| project:human_name_creativity [2019/09/08 15:16] – created dsievi | project:human_name_creativity [2019/09/24 01:34] (current) – [Human Name Creativity] dsievi | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Human Name Creativity ===== | ===== Human Name Creativity ===== | ||
| - | (screenshots | + | Following the last years project about dog names Dog Name Creativity Survey of New York City [[project: |
| + | |||
| + | Unfortunately it wasn’t finished until the end of the Hackathon, no UI, but here's the last draft version of the code: | ||
| + | < | ||
| + | import pandas as pd | ||
| + | |||
| + | HaufeD_ = {" | ||
| + | " | ||
| + | HaufeF_ = {" | ||
| + | " | ||
| + | ," | ||
| + | #HaufeI_ = | ||
| + | landics = {" | ||
| + | |||
| + | def KreaWert(name_, | ||
| + | dic = landics[lan] | ||
| + | name_ = str(name_) | ||
| + | wert_ = 0 | ||
| + | for letter in str.lower(name_): | ||
| + | temp_ = 0 | ||
| + | if letter in dic : | ||
| + | temp_ += dic[letter] | ||
| + | wert_ += temp_ | ||
| + | else: | ||
| + | temp_ += 20 | ||
| + | wert_ += temp_ | ||
| + | try: | ||
| + | H_[name_] | ||
| + | wert_ = wert_* ((Hmax-H_[name_])/ | ||
| + | except KeyError as exception: | ||
| + | pass | ||
| + | if len(name_) < (DNL-2) | ||
| + | wert_ = wert_/ | ||
| + | return round(wert_, | ||
| + | |||
| + | df = pd.read_csv(" | ||
| + | df[" | ||
| + | |||
| + | insgeNamLan_ = 0 | ||
| + | for name in df[" | ||
| + | insgeNamLan_ += len(str(name)) | ||
| + | |||
| + | # | ||
| + | DNL = round(insgeNamLan_ / len(df[" | ||
| + | |||
| + | # | ||
| + | H_ = {} | ||
| + | counter = 0 | ||
| + | for name in df[" | ||
| + | if name in H_: | ||
| + | H_[name] += df[" | ||
| + | counter += 1 | ||
| + | else: | ||
| + | H_[name] = df[" | ||
| + | counter +=1 | ||
| + | sortH_ = sorted(H_.values()) | ||
| + | Hmax = sortH_[len(sortH_)-1] | ||
| + | Hmin = sortH_[0] | ||
| + | |||
| + | lan = input(" | ||
| + | name_ = input(" | ||
| + | |||
| + | print(KreaWert(name_, | ||
| + | </ | ||
| - | In addition to the last years project about dog names. This year the focus was about human first names. | ||
| - | ... | ||
| ===== Data ===== | ===== Data ===== | ||