Back to SDS/2 Parametric Scripts
# word
count of text file
import os, re
data_file = (os.path.join('H:\\', 'TEMP', 'temsys', 'Anchor Rod
Plans.txt'))
def concordance(wordDict, lines):
key =
wordDict.keys()[0]
for lineNum, line
in enumerate(lines):
for word in
line.split():
if
word.lower().strip(",.!?:()[]/\\\n\"\'") == key:
wordDict[key][0].append(lineNum+1)
wordDict[key][1] += 1
return wordDict
def wordList(fn):
wDict = {}
patt =
re.compile(r'[a-zA-Z]')
f = open(data_file,
'r')
lineList =
f.readlines()
words =
"".join(lineList).split()
f.close()
for w in words:
if
patt.search(w):
wDict[w.lower().strip(".,:?!()[]/\\\n\"\'")] = [[],0]
f.close()
return wDict,
lineList
conDict = {}
d, lines = wordList(data_file)
for item in d.items():
conDict.update(concordance({item[0]:
item[1]}, lines))
for item, value in conDict.items():
print 'Word:
%s Lines: %s Total occurances: %s' % (item, value[0],
value[1])
listCopy = d.keys()
listCopy.sort()
outStr = []
for w in listCopy:
outStr.append('%s
%s\n' % (w, d[w]))
print "".join(outStr)
# Data file source and output
"""
As president of the
users group my vote does not count by rule. However, since
I can post it, here are some opinions for the record:
Bottom of base plate
elevations should always be actual (match the model).
An elevation should
be shown at each column. Many times we will establish 0-0
as the finished floor elevation for the model
and we end up with both relative
and actual. Options to show the elevations as
relative and to show only the
elevations that are different from a typical elevation
would be OK with me.
I prefer picture 1
except get rid of the parentheses and prefix the elevation
with "EL ". A note under the plan
header could read "EL X-XX INDICATES BOTTOM
OF
BASE PLATE ELEVATION".
The less text at each column, the better.
Regarding the base
plate subassembly mark - Most columns use the plate
definition schedule for base plate information. This is
one of the first
things that is completed, even before the
are listed as BP1, BP2, BP3.... in some logical
manner to equate with the
project column base plate schedule. Our anchor rod
plans display information
at three levels - the plan, the large scale
base plate details (1=12 normally)
and the large scale typical anchor rod
installation details. Having the base
plate subassembly mark at each column will do two
things - reference the large
scale base plate details and provide the checker
with a check of the column bases
in the model without having to check each
column in the model. So far I have
noticed that the consensus is "NEVER
REQUIRED". Not to be contrary but "I NEED
THEM". Option,
please? Member marks should be masked by default.
'This is a test
line' to, :see "if" (unwanted)? [chaRActers!] !aRe reMoved....
"""
"""
>>> a [[8, 11, 22,
26], 4]
abm [[16], 1]
actual [[4, 7], 2]
always [[4], 1]
an [[5], 1]
anchor [[18, 20], 2]
and [[6, 7, 7, 10, 20, 22], 6]
are [[2, 8, 17, 26], 4]
as [[1, 6, 7, 17], 4]
at [[5, 12, 19, 21], 4]
base [[4, 12, 14, 15, 16, 18, 19, 20, 22], 9]
bases [[22], 1]
be [[4, 5, 8, 24, 25], 5]
before [[16], 1]
better [[12], 1]
both [[6], 1]
bottom [[4, 11], 2]
bp1 [[17], 1]
bp2 [[17], 1]
bp3 [[17], 1]
but [[24], 1]
by [[1, 25], 2]
can [[2], 1]
characters [[26], 1]
check [[22, 23], 2]
checker [[22], 1]
column [[5, 12, 18, 21, 22, 23], 6]
columns [[14], 1]
completed [[16], 1]
consensus [[24], 1]
contrary [[24], 1]
could [[11], 1]
count [[1], 1]
default [[25], 1]
definition [[15], 1]
details [[19, 20, 22], 3]
different [[8], 1]
display [[18], 1]
do [[21], 1]
does [[1], 1]
each [[5, 12, 21, 23], 4]
el [[11, 11], 2]
elevation [[5, 6, 8, 10, 12], 5]
elevations [[4, 7, 8], 3]
end [[6], 1]
equate [[17], 1]
establish [[5], 1]
even [[16], 1]
except [[10], 1]
far [[23], 1]
finished [[6], 1]
first [[15], 1]
floor [[6], 1]
for [[2, 6, 15], 3]
from [[8], 1]
get [[10], 1]
group [[1], 1]
have [[23], 1]
having [[20, 23], 2]
header [[11], 1]
here [[2], 1]
however [[1], 1]
i [[2, 10, 23, 24], 4]
if [[26], 1]
in [[17, 23, 23], 3]
indicates [[11], 1]
information [[15, 18], 2]
installation [[20], 1]
is [[15, 16, 24, 26], 4]
it [[2], 1]
large [[19, 20, 21], 3]
less [[12], 1]
levels [[19], 1]
line [[26], 1]
listed [[17], 1]
logical [[17], 1]
manner [[17], 1]
many [[5], 1]
mark [[14, 21], 2]
marks [[25], 1]
masked [[25], 1]
match [[4], 1]
me [[8], 1]
member [[25], 1]
model [[4, 6, 23, 23], 4]
most [[14], 1]
my [[1], 1]
need [[24], 1]
never [[24], 1]
normally [[19], 1]
not [[1, 24], 2]
note [[11], 1]
noticed [[24], 1]
of [[1, 4, 10, 12, 15, 22], 6]
ok [[8], 1]
one [[15], 1]
only [[7], 1]
opinions [[2], 1]
option [[25], 1]
options [[7], 1]
our [[18], 1]
parentheses [[10], 1]
picture [[10], 1]
piecemarks [[16], 1]
plan [[11, 19], 2]
plans [[18], 1]
plate [[4, 12, 14, 14, 15, 16, 18, 19, 21, 22],
10]
please [[25], 1]
post [[2], 1]
prefer [[10], 1]
prefix [[10], 1]
president [[1], 1]
project [[18], 1]
provide [[22], 1]
read [[11], 1]
record [[2], 1]
reference [[21], 1]
regarding [[14], 1]
relative [[6, 7], 2]
removed [[26], 1]
required [[24], 1]
rid [[10], 1]
rod [[18, 20], 2]
rule [[1], 1]
scale [[19, 20, 22], 3]
schedule [[15, 18], 2]
see [[26], 1]
should [[4, 5, 25], 3]
show [[7, 7], 2]
shown [[5], 1]
since [[1], 1]
so [[23], 1]
some [[2, 17], 2]
subassembly [[14, 21], 2]
test [[26], 1]
text [[12], 1]
that [[8, 16, 24], 3]
the [[1, 2, 4, 6, 6,
7, 7, 10, 10, 11, 12, 12, 14, 14, 15, 16, 16, 17, 19, 19, 20, 20, 21, 22, 22,
23, 23, 24], 28]
them [[25], 1]
things [[16, 21], 2]
this [[15, 26], 2]
three [[19], 1]
times [[5], 1]
to [[7, 7, 17, 23, 24, 26], 6]
two [[21], 1]
typical [[8, 20], 2]
under [[11], 1]
unwanted [[26], 1]
up [[6], 1]
use [[14], 1]
users [[1], 1]
vote [[1], 1]
we [[5, 6], 2]
will [[5, 21], 2]
with [[6, 8, 11, 17, 22], 5]
without [[23], 1]
would [[8], 1]
x-xx [[11], 1]
>>>
"""