askcomm: Python 3 module - Search patterns for event-based, community-detected twitter data.
By Chris Lindgren chris.a.lindgren@gmail.com
Distributed under the BSD 3-clause license. See LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause for details.
Overview
A set of search patterns that query a corpus of event-based and community-detected tweets, but it could be modified to query most social-network (node-edge) data. The queries are great for content produced within the detected-community subgraph data.
It assumes you have:
- imported your corpus as a pandas DataFrame,
- included metadata information, such as a list of dates and list of groups to reorganize your corpus, and
- pre-processed your documents as community-detected data across periodic events.
Functions
query_controller: Accepts corpus and hub user data and searches for tweets germane to the detected module community across a range of periods and communities. It uses the find_mentions function to conduct a cross-reference search within a period's data range with 2 options: 'mentions_only' or 'user_and_mentions'. 'mentions_only' searches a column with a List of mentions per tweet. 'user_and_mentions' cross references the author of a tweet with the list of mentions. It returns a Dict of top result tweets found during that period.
query_controller(
hubs=df_hubs,#community-detected data
hub_col_period='period',#column name for periods
hub_col_module='info_module',# column name for community name
hub_col_users='name',#column name for
period_range=[1,10],#range of desired periods
module_range=[1,10],#range of desired communities/modules
corpus=c_htg,#content corpus
period_dates=period_dates,#List of lists with dates to
col_dates='dates'#column name for dates
)
convert_to_df: Converts the Dict output from query_controller into a Dataframe with top result per user. If no tweet found , appends as None.
find_ht: Queries subset of isolated mentioned or authored tweets with hashtag group list. It returns another subset as a dataframe.
find_links: Queries links in tweets with search string. It returns subset as a dataframe.
Other functions include: find_mentions and print_subset.
It functions only with Python 3.x and is not backwards-compatible.
Warning: askcomm performs little to no custom error-handling, so make sure your inputs are formatted properly. If you have questions, please let me know via email.
System requirements
- pandas
Installation
- Download this repo onto your computer.
- Store the folder in a meaningful location.
- Open a terminal.
- In the terminal, navigate to the root of the folder.
- In the terminal, run
pip install .
Known Issues or Limitations
- Please contact me if you discover any issues.
Example notebooks
- Coming soon.
Distribution update terminal commands
# Create new distribution of code for archiving sudo python setup.py sdist bdist_wheel # Distribute to Python Package Index python -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
Metadata
Release files for askcomm 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| askcomm-0.0.2.tar.gz | 5.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| askcomm-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.1 kB
Release files / askcomm-0.0.2.tar.gz
| Download URL | askcomm-0.0.2.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f1e7c73057c4da66fbec9cde3b77bf8c85afda50a319b6f0f8d1d259c47e8f8
|
|
BLAKE2b-256 checksum How to use checksums |
40008370bb7e61b8247dbaaf43fead625e9bc1c2f881cf4d8b0a0da4010c725a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.5
|
Release files / askcomm-0.0.2-py3-none-any.whl
| Download URL | askcomm-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6cd3d1647bfd2a7e4569b417ec136a4856563244cc9723ac7aa5f074d9d2c58
|
|
BLAKE2b-256 checksum How to use checksums |
967b0039649e6711663f0f0137d7aef4e49ebc840a883e1c0e444cf2bdb1582d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.5
|
Security for askcomm 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.