Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
project:human_name_creativity [2019/09/10 23:30] – dsievi | project:human_name_creativity [2019/09/24 01:34] (current) – [Human Name Creativity] dsievi | ||
---|---|---|---|
Line 5: | Line 5: | ||
Unfortunately it wasn’t finished until the end of the Hackathon, no UI, but here's the last draft version of the code: | 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) or len(name_) > (DNL+2): | ||
+ | wert_ = wert_/10*8 | ||
+ | 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_, | ||
</ | </ | ||