Skip to main content

TakeMessageCleaner is a tool for pre processing messages

Project description

TakeMessageCleaner

TakeMessageCleaner is a tool for pre processing messages. It can be used to convert messages to lower case, correct spelling, remove elements like punctuation, emoji, whatapp's emoji, accentuation, number, cpf, url, e-mail, money, code, time, date and small talks. Also, it can pre process data from a dataframe, series, list or csv file.

MessageCleaner.from_dataframe: creates a constructor from a dataframe

  • config_file_path: str
  • config_file_path is the path of the json file with the configuration
  • dataframe: pd.core.frame.DataFrame
  • dataframe is the pandas dataframe that needs to be processed.
  • content_column : str
  • content_column is the column name of the dataframe that has the information to be processed.

MessageCleaner.from_series: creates a constructor from a series

  • config_file_path: str
  • config_file_path is the path of the json file with the pre processing
  • series: pd.core.frame.Series
  • series is the pandas series that needs to be processed.

    MessageCleaner.from_list: creates a constructor from a list

    • config_file_path: str
    • config_file_path is the path of the json file with the configuration
    • lst: list
    • lst is the list of string that need to be processed.

    MessageCleaner.from_file: creates a constructor from a csv file

    file_path : str, content_column : str = 'Content', encoding: str = 'utf-8', sep: str = ';'

    • config_file_path: str
    • config_file_path is the path of the json file with the configuration
    • file_path : strt
    • file_path is the path of the csv file that needs to be processed.
    • content_column: str
    • content_column is the column name of the dataframe that has the information to be processed. If the file separator is not set, the value 'Content' will be used.
    • sep: str
    • sep is the csv file separator. If the file separator is not set, the value ';' will be used.
    • encoding: str
    • encoding is the encoding of the csv file. If the file encoding is not set, the value 'utf-8' will be used.

    MessageCleaner.pre_process: pre-process messages using a json file with the configuration.

    The pre processing step is able to convert sentences to lower case, correct spelling and remove elements like punctuation, emoji, whatapp emoji, accentuation, number, cpf, url, e-mail, money, code, time, date and small talks. Optionally, you can activate use_placeholder to insert a placeholder where the element was removed. For example: "I want 2 apples" would be converted in "I want NUMBER apples".

    config.json

    {
    	"use_placeholder": true,
    	"verbose": true, 
    	"processing": {
    		"lower": true,
    		"punctuation": true,
    		"emoji": true,
    		"wa_emoji": true,
    		"accentuation": true,
    		"number": true,
    		"cpf": true,
    		"url": true,
    		"email": true,
    		"money": true,
    		"code": true,
    		"time": true,
    		"date": true,
    		"spelling": true
    	},
    	"output": {
    		"file_name": "output_file.csv",
    		"file_encoding" : "utf-8",
    		"file_sep": ";",
    		"remove_duplicates": true,
    		"remove_empty": true,
    		"sort_by_length": true
    	}
    }
    

    Installation

    Use the package manager pip to install TakeMessageCleaner

    pip install TakeMessageCleaner
    

    Usage

    import MessageCleaner as mc
    
    cleaner = mc.MessageCleaner.from_file(config_file_path = 'C:/Documents/config.json', file_path = 'C:/Users/mydata.csv', sep = ';', encoding = 'latin-1')
    result = cleaner.clean()
    print(result)
    

    Author

    Karina Tiemi Kato

    License

    MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TakeMessageCleaner-1.1.4.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

TakeMessageCleaner-1.1.4-py3-none-any.whl (49.5 kB view details)

Uploaded Python 3

File details

Details for the file TakeMessageCleaner-1.1.4.tar.gz.

File metadata

  • Download URL: TakeMessageCleaner-1.1.4.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for TakeMessageCleaner-1.1.4.tar.gz
Algorithm Hash digest
SHA256 af7de73552d3f7d79bf1223a1472e1672ca002e333bbabf7728e56d2737bd072
MD5 1fec160a51a60601a00ab51e1b6abf49
BLAKE2b-256 26cbb977c71a6a34322e23bee45b0be39ee0d0b3885f8383ff7b50d796119ff5

See more details on using hashes here.

File details

Details for the file TakeMessageCleaner-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: TakeMessageCleaner-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for TakeMessageCleaner-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 57e1712e65bb7e5a300dd019f941955c67e8e7e31b3ac0c485a2e06b4400b58d
MD5 4491f938eaa06ec9dfafd46e8a889063
BLAKE2b-256 e40cf1b4e6d2cb765d09b8cf06ce1865e6a5ecf24561a5f4e8cab67f46822f28

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page