Geschlecht Erkennung von Text mit Python programmieren

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
Kingoffly
User
Beiträge: 8
Registriert: Freitag 11. November 2022, 19:10

Ich muss ein Programm schreiben, dass ein Geschlecht erkennt durch ein Text.

Aufgabestellung:
Use the developed functions to write a program which does very basic gender detection.
E.g., you could implement a rule of thumb that decides "male" if less than x words are given in response to a prompt, and "female" if the input text is considerably long or has many first-person singular pronouns ("unknown" otherwise).

Ich finde den Ansatz nicht. Kann mir da jemand helfen?
__deets__
User
Beiträge: 14545
Registriert: Mittwoch 14. Oktober 2015, 14:29

Was ist denn das für eine sexistische und stereotypisiernde Aufgabe? Frauen reden mehr, und über sich? Der Ansatz ist, das abzubrechen, weil es hanebüchener Quatsch ist.
Kingoffly
User
Beiträge: 8
Registriert: Freitag 11. November 2022, 19:10

2.2 Gender Detection in Text
Write functions to automatically detect certain features of a text document (such as the gender of the author). For all functions, assume a text document as input in form of a single string, and create meaningful function- and parameter-names.
Background: The average native English speaker knows ca. one hundred thousand words. According to new research by psychologist James W. Pennebaker, however, the most revealing words in this impressive vocabulary are the ones we barely notice at all.
Gender-based language variations were among the first topics that Pennebaker studied with LIWC. Not surprisingly, he found that there are striking differences between the language usage of men and women. After analyzing thousands of blogs, essays, and other writing samples, he found that women use first-person singular pronouns like "I", "me", and "my" more frequently than men; according to his research, the average woman will use about 85,000 more pronouns per year than will the average man. Pennebaker attributes these findings to the tendency of women to be more self-aware than men, as has been documented by numerous psychological studies. He also found that women use more verbs and hedge phrases (such as "I think" and "I believe"), whereas men tend to use more numbers, nouns, and words per sentence.2
2.2.1 Count first-person singular pronouns
Write a function that counts the number of first-person singular pronouns (I, me, my) in a given text.
2.2.2 Document Length
Write a function that computes the number of words in a given text.
2.2.3 Words per Sentence
Write a function that computes the average number of words in a sentence for a given text.
2.2.4 Gender Detection
Use the developed functions to write a program which does very basic gender detection.
E.g., you could implement a rule of thumb that decides "male" if less than x words are given in response to a prompt, and "female" if the input text is considerably long or has many first-person singular pronouns ("unknown" otherwise).

Es ist ein Übungsaufgabe, ich habe bis und mit 2.2.3 geschafft. Bei 2.2.4 finde ich den Ansatz nicht.
Benutzeravatar
__blackjack__
User
Beiträge: 14069
Registriert: Samstag 2. Juni 2018, 10:21
Wohnort: 127.0.0.1
Kontaktdaten:

@Kingoffly: Der Ansatz steht doch in der Aufgabe selbst schon. Wobei hast Du da konkret ein Problem?
“Vir, intelligence has nothing to do with politics!” — Londo Mollari
Kingoffly
User
Beiträge: 8
Registriert: Freitag 11. November 2022, 19:10

Ich verstehe es nicht, wie man das unterscheiden von Man zu Frau programmiert. Ich bin kein Programmierer habe in der Schule ein neben Fach.
Kingoffly
User
Beiträge: 8
Registriert: Freitag 11. November 2022, 19:10

Kann mir da jemand helfen beim Programmieren. Ich bin ein Anfänger.
Benutzeravatar
__blackjack__
User
Beiträge: 14069
Registriert: Samstag 2. Juni 2018, 10:21
Wohnort: 127.0.0.1
Kontaktdaten:

@Kingoffly: Na ein möglicher Ansatz steht doch da direkt in der Aufgabe. Den kannst Du doch einfach erst einmal umsetzen.

Wenn Du kein Programmierer bist, musst Du einer werden. Das ist ja offenbar das zumindest mittelbare Ziel von dieser Aufgabenstellung. Die kann man nur lösen wenn man programmieren lernt. Und die vorherigen Teilaufgaben, die Du nach eigener Aussage schon gelöst hast, erfordern das auch schon. Darum ist das jetzt ein bisschen verwirrend, dass die kein Problem waren, bei der letzten aber jetzt Probleme entstehen. Du aber auch irgendwie nicht konkret sagst *was* das Problem ist. Zumindest mal die Faustregel aus der Aufgabe in Code umzusetzen.

Und vielleicht erwartet der Aufgabensteller sogar, dass Du Dich mit der Arbeit von Pennebaker auseinandersetzt um eventuell sinnvolle Schwellwerte für „langer Text“ oder „viele Pronomen in der ersten Person Einzahl“ angeben zu können.
“Vir, intelligence has nothing to do with politics!” — Londo Mollari
Benutzeravatar
noisefloor
User
Beiträge: 4195
Registriert: Mittwoch 17. Oktober 2007, 21:40
Wohnort: WW
Kontaktdaten:

Hallo,
Use the developed functions to write a program which does very basic gender detection.
Der erste Teil des Satzes ist doch der wichtige Hinweis. Wenn du bis 2.2.3 alles hast, dann hast du 2.2.4 doch zur Hälfte gelöst. Du musst noch die Ergebnisse zusammen ziehen, zählen und in "male" oder "female" Klassifizieren. Das geht vermutlich mit einen einfachen `if... elif ... else`, wo du beim `if` und `elif` die Grenze für die einzelnen Klassifizierungspunkte festlegst und mit `and` verknüpfst.

Gruß, noisefloor
Antworten