コード例 #1
0
ファイル: interrogation.py プロジェクト: kareem180/corpkit
    def quickview(self, n = 25):
        """view top n results as painlessly as possible.

           >>> data.quickview(n = 5)

        :param n: Show top *n* results
        :type n: int
        :returns: None
        """
        from corpkit import quickview
        quickview(self, n = n)
コード例 #2
0
ファイル: session-3.py プロジェクト: datakid/nltk
# <markdowncell>
# Aside from *interrogator()* and *plot()*, there are also a few simple functions for viewing and editing results.

# <headingcell level=4>
# quickview()

# <markdowncell>
# *quickview()* is a function that quickly shows the n most frequent items in a list. Its arguments are:
#
# 1. an *interrogator()* result
# 2. number of results to show (default = 50)
#
# We can see the full glory of bad OCR here:

# <codecell>
quickview(aust.results, n = 20)

# <markdowncell>
# The number shown next to the item is its index. You can use this number to refer to an entry when editing results.

# <headingcell level=4>
# tally()

# <markdowncell>
# *tally()* displays the total occurrences of results. Its first argument is the list you want tallies from. For its second argument, you can use:

# * a list of indices for results you want to tally
# * a single integer, which will be interpreted as the index of the item you want
# * a string, 'all', which will tally every result. This could be very many results, so it may be worth limiting the number of items you pass to it with [:n],

# <codecell>
コード例 #3
0
ファイル: orientation.py プロジェクト: agogear/corpkit
#rel_riskwords = editor(rel_riskwords.totals, skip_subcorpora = [1963])
#plotter('Relative frequency of risk words', rel_riskwords.totals)

# <markdowncell>
# Perhaps we're interested in not only the frequency of risk words, but the frequency of different *kinds* of risk words. We actually already collected this data during our last `interrogator()` query.

# We can print just the first few entries of the results list, rather than the totals list.

# <codecell>
# using Pandas syntax:
riskwords.results.head(10)

# <codecell>
# using quickview
from corpkit import quickview
quickview(riskwords.results, n = 10)

# <markdowncell>
# So, let's use this data to do some more serious plotting:

# <codecell>
frac1 = editor(riskwords.results, '%', riskwords.totals)

# an alternative syntax:
# frac1 = editor(riskwords.results, '%', 'self')

# <codecell>
# a colormap is used for > 7 results
plotter('Risk word / all risk words', frac1.results, num_to_plot = 9)

# <markdowncell>
コード例 #4
0
ファイル: interrogation.py プロジェクト: kareem180/corpkit
 def quickview(self, n = 25):
     """Print top results from an interrogation or edit"""
     from corpkit import quickview
     quickview(self, n = n)