File: givens_gender.ll

package info (click to toggle)
lifelines 3.0.50-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 11,140 kB
  • ctags: 6,517
  • sloc: ansic: 57,468; xml: 8,014; sh: 4,255; makefile: 848; yacc: 601; perl: 170; sed: 16
file content (76 lines) | stat: -rw-r--r-- 2,328 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * @progname       givens_gender.ll
 * @version        1
 * @author         Jim Eggert (eggertj@ll.mit.edu)
 * @category       
 * @output         Text
 * @description

Given name gender report program.
This program prints a list of all given names of people, tagged by one
of the following:
M  Only males
F  Only females
B  Males and females
M? Males and persons of unknown gender
F? Females and persons of unknown gender
B? Males, females, and persons of unknown gender

Very few names should be marked as B.  Check them carefully and you
may find some database gender errors.  You may be able to help resolve
unknown genders for those names tagged M? and F?.

If you want to sort the report by name only, do
  sort +1b -2b report > report.sort
If you want to sort the report by gender and name, do
  sort report > report.sort

If you want to find a person with a specific given name and gender,
use givens_gender_finder.

        by Jim Eggert (eggertj@ll.mit.edu)
        Version 1 (19 April 1995) requires LifeLines 3.0.1 or later.
*/

proc main() {
    table(namestable)
    list(nameslist)
    list(codelist)
    list(names)
    print("Collecting names...")
    set(namescount,0)
    forindi(person,pnum) {
/* if (gt(pnum,300)) { break() } */
        if (male(person)) { set(a,15) set(m,2) }
        elsif (female(person)) { set(a,10) set(m,3) }
        else { set(a,6) set(m,5) }
        extractnames(inode(person),names,nnames,isurname)
        forlist(names,name,iname) {
            if (ne(iname,isurname)) {
                if (l,lookup(namestable,name)) {
                    if (not(mod(l,m))) {
                        insert(namestable,save(name),add(l,a))
                    }
                }
                else {
                    set(sname,save(name))
                    insert(namestable,sname,a)
                    enqueue(nameslist,sname)
                    incr(namescount)
                }
            }
        }
    }
    setel(codelist, 6,"?  ")
    setel(codelist,10,"F  ")
    setel(codelist,15,"M  ")
    setel(codelist,16,"F? ")
    setel(codelist,21,"M? ")
    setel(codelist,25,"B  ")
    setel(codelist,31,"B? ")
    print("done\nPrinting ", d(namescount)," names...")
    while(name,dequeue(nameslist)) {
        getel(codelist,lookup(namestable,name))
        name "\n"
    }
}