pyviralcontent


Namepyviralcontent JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/bhaskatripathi/pyviralcontent
SummaryA package for analyzing content readability and virality potential.
upload_time2024-01-23 17:13:42
maintainer
docs_urlNone
authorBhaskar Tripathi
requires_python
license
keywords readability virality content-analysis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyViralContent



`pyviralcontent` is a Python package designed to assess the readability of various types of content and predict the and the probability of the content going viral. It employs multiple readability tests and translates numerical scores into qualitative descriptors based on the Likert scale. The package supports various types of content, allowing for a tailored analysis based on the specific nature of the content.



## Supported Content Types



The package currently supports the following content types:



- `scientific`

- `blog`

- `video`

- `technical`

- `fictional`

- `legal`

- `educational`

- `news`

- `advertising`

- `social_media`



## Installation



```

pip install pyviralcontent

```



## Usage

To analyze your content, you can use the `ContentAnalyzer` class from the `pyviralcontent` package. Here's a simple example of how to use the `ContentAnalyzer` to analyze different types of content:





```python

from pyviralcontent import ContentAnalyzer



def test_content_analysis(content_type, text_content):

    """

    Test the content analysis for a given type of content and text content.



    :param content_type: The type of the content (e.g., 'scientific', 'blog', etc.).

    :param text_content: The actual content to analyze.

    """

    # Create an instance of ContentAnalyzer

    analyzer = ContentAnalyzer(text_content, content_type)

    # Perform the analysis

    df, viral_probability = analyzer.analyze()

    # Print the results

    print(f"\nReadability Scores Summary for {content_type.capitalize()} Content:")

    display(df)

    print(f"The probability of the content going viral is: {viral_probability * 100:.2f}%")



# Example 1: Scientific content

test_content_analysis(

    'scientific',

    "Implement an accessibility-first approach in the design of the website. This includes: • High-contrast visuals for low-vision users. • Text-to-speech functionality for all text, including product descriptions and checkout processes.• Easy keyboard navigation for those unable to use a mouse."

)



# Example 2: Blog content

test_content_analysis(

    'blog',

    "Today's blog post discusses the importance of user experience design. A good design ensures that users find joy and satisfaction in the interaction with the product, making it an essential aspect of product development."

)



# Example 3: Technical content

test_content_analysis(

    'technical',

    "The module utilizes an advanced algorithm for data processing, ensuring high performance and reliability. It's optimized for multi-threaded environments, offering significant improvements in processing speed and efficiency."

)



# Example 4: Fictional content

test_content_analysis(

    'fictional',

    "In the distant future, humanity has reached the stars. Each galaxy is a new frontier, and every planet a new adventure. Join our heroes as they navigate through cosmic dangers and discover the mysteries of the universe."

)



# Example 5: Legal content

test_content_analysis(

    'legal',

    "The contract stipulates the terms and conditions of the agreement and is legally binding to both parties involved. It outlines the responsibilities, duties, and liabilities in clear, unambiguous language to prevent any misunderstandings."

)



# Example 6: Educational content

test_content_analysis(

    'educational',

    "Today's lesson covers the fundamental principles of physics. We'll explore Newton's laws of motion, the concept of gravity, and the principles of energy and momentum. Each concept will be demonstrated with real-life examples and interactive experiments."

)



# Example 7: News content

test_content_analysis(

    'news',

    "In today's news, the local community is coming together to support the annual food drive. Last year's drive helped over a thousand families, and this year the organizers hope to double that number with the help of generous donations and volunteer work."

)



# Example 8: Advertising content

test_content_analysis(

    'advertising',

    "Introducing the latest innovation in home cleaning! Our new vacuum cleaner is equipped with advanced technology to clean your home efficiently and effortlessly. Say goodbye to dust and hello to spotless floors!"

)



# Example 9: Social Media content

test_content_analysis(

    'social_media',

    "Just finished an amazing workout at the gym! 💪 Feeling energized and ready to take on the day. Remember, a healthy lifestyle is not just a goal, it's a way of living. #FitnessGoals #HealthyLiving"

)



# Example 10: Video content

test_content_analysis(

    'video',

    "In this video, we'll take a closer look at the intricate ecosystem of the Amazon rainforest. Discover the diverse species that call it home, and learn about the critical role it plays in our planet's climate system."

)

```

![Sample Image](https://github.com/bhaskatripathi/pyviralcontent/blob/main/Sample.JPG?raw=true)





## Features



- Multiple readability tests for different content types.

- Qualitative descriptors based on the Likert scale.

- Estimation of content's virality potential.

- Supported content types include: scientific, blog, video, technical, fictional, legal, educational, news, advertising, social_media.



## How it Works?



The `PyViralContent` package offers a sophisticated approach to analyzing textual content by recognizing that no single readability metric is representative fits all content types. This is essential a Multi Criteria Decision Analysis Problem which is solved using Keener's method. Different types of content have unique stylistic and structural characteristics, and the package addresses this by associating specific readability formulas with each content type. This method ensures a nuanced analysis and provides a more accurate reflection of the content's readability and potential virality.



### Content Type Formulas



The package defines `content_type_formulas`, a mapping of content types to the sets of readability formulas that are best suited for those types. Here's the association between content types and their corresponding readability formulas. These formulae have been integrated using Keener's MCDA method. Keener's method computes the eigenvector corresponding to the largest eigenvalue of a certain matrix derived from the pairwise comparisons. This eigenvector provides the weights or ratings of the items being compared, reflecting their relative importance or dominance in the context of the comparison.

![UML](https://github.com/bhaskatripathi/pyviralcontent/blob/main/UML.png)

For a detailed explanation of Keener's method and its applications, please refer to the following resource:

[Understanding Keener's Method (PDF)](https://www.dcs.bbk.ac.uk/~ale/dsta+dsat/dsta+dsat-3/lm-ch3-keener.pdf)



The `PyViralContent` package integrates Keener's method in its analytical engine to enhance the robustness and depth of the content analysis, offering users a sophisticated tool for assessing the potential impact and reach of their content.



| Content Type  | Readability Formulas Used               |

|---------------|-----------------------------------------|

| Scientific    | Gunning Fog, Coleman Liau, ARI          |

| Blog          | Flesch Reading Ease, Flesch Kincaid     |

| Video         | SMOG, Flesch Reading Ease               |

| Technical     | Linsear Write, ARI                      |

| Fictional     | Flesch Kincaid, Coleman Liau            |

| Legal         | Gunning Fog, SMOG                       |

| Educational   | Flesch Kincaid, Linsear Write           |

| News          | Flesch Reading Ease, Gunning Fog        |

| Advertising   | Flesch Reading Ease, Coleman Liau       |

| Social Media  | Flesch Reading Ease, Linsear Write      |



### Interpretation with Likert Scale



The results from the readability formulas are interpreted using a Likert scale, which provides a qualitative measure of the content's readability. This scale is not one-size-fits-all; it is tailored to each readability formula to accurately reflect the nuances of each metric. Here's how the Likert scale is applied for each readability formula:



| Readability Formula     | Likert Scale Interpretation (Score Range)  | Qualitative Descriptor     |

|-------------------------|--------------------------------------------|----------------------------|

| Flesch Reading Ease     | 90-inf: 5, 70-90: 4, 50-70: 3, 30-50: 2, 0-30: 1 | Very Easy to Very Confusing |

| Flesch Kincaid          | <=5: 5, 5-6: 4, 6-7: 3, 7-9: 2, >=9: 1     | Very Easy to Very Confusing |

| Gunning Fog             | <=6: 5, 6-8: 4, 8-12: 3, 12-17: 2, >=17: 1 | Very Easy to Very Confusing |

| SMOG                    | <=6: 5, 6-8: 4, 8-12: 3, 12-14: 2, >=14: 1 | Very Easy to Very Confusing |

| Linsear Write           | <=5: 5, 5-8: 4, 8-12: 3, 12-15: 2, >=15: 1 | Very Easy to Very Confusing |

| Coleman Liau            | <=5: 5, 5-8: 4, 8-12: 3, 12-15: 2, >=15: 1 | Very Easy to Very Confusing |

| ARI                     | <=2: 5, 2-4: 4, 4-7: 3, 7-10: 2, >=10: 1   | Very Easy to Very Confusing |



These ranges and descriptors ensure that the readability score is not just a number, but a meaningful indicator of how the content will likely be received by the intended audience. The `PyViralContent` package provides a detailed output, including both the readability scores from each formula used and the overall virality probability, offering valuable insights into the potential reach and impact of the content analyzed.





## Contributing



Contributions to `pyviralcontent` are welcome! Please feel free to submit issues, fork the repository, and create pull requests.



## License



This project is licensed under the MIT License - see the LICENSE file for details.



## Contact



Bhaskar Tripathi - bhaskar.tripathi@gmail.com

GitHub: https://github.com/bhaskatripathi/pyviralcontent


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bhaskatripathi/pyviralcontent",
    "name": "pyviralcontent",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "readability virality content-analysis",
    "author": "Bhaskar Tripathi",
    "author_email": "bhaskar.tripathi@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d6/53/785bd34ac1fa6627992ec3e62ccd8d97374eb3c4bad3c98ff131fbec58ff/pyviralcontent-0.1.5.tar.gz",
    "platform": null,
    "description": "# PyViralContent\r\n\r\n\r\n\r\n`pyviralcontent` is a Python package designed to assess the readability of various types of content and predict the and the probability of the content going viral. It employs multiple readability tests and translates numerical scores into qualitative descriptors based on the Likert scale. The package supports various types of content, allowing for a tailored analysis based on the specific nature of the content.\r\n\r\n\r\n\r\n## Supported Content Types\r\n\r\n\r\n\r\nThe package currently supports the following content types:\r\n\r\n\r\n\r\n- `scientific`\r\n\r\n- `blog`\r\n\r\n- `video`\r\n\r\n- `technical`\r\n\r\n- `fictional`\r\n\r\n- `legal`\r\n\r\n- `educational`\r\n\r\n- `news`\r\n\r\n- `advertising`\r\n\r\n- `social_media`\r\n\r\n\r\n\r\n## Installation\r\n\r\n\r\n\r\n```\r\n\r\npip install pyviralcontent\r\n\r\n```\r\n\r\n\r\n\r\n## Usage\r\n\r\nTo analyze your content, you can use the `ContentAnalyzer` class from the `pyviralcontent` package. Here's a simple example of how to use the `ContentAnalyzer` to analyze different types of content:\r\n\r\n\r\n\r\n\r\n\r\n```python\r\n\r\nfrom pyviralcontent import ContentAnalyzer\r\n\r\n\r\n\r\ndef test_content_analysis(content_type, text_content):\r\n\r\n    \"\"\"\r\n\r\n    Test the content analysis for a given type of content and text content.\r\n\r\n\r\n\r\n    :param content_type: The type of the content (e.g., 'scientific', 'blog', etc.).\r\n\r\n    :param text_content: The actual content to analyze.\r\n\r\n    \"\"\"\r\n\r\n    # Create an instance of ContentAnalyzer\r\n\r\n    analyzer = ContentAnalyzer(text_content, content_type)\r\n\r\n    # Perform the analysis\r\n\r\n    df, viral_probability = analyzer.analyze()\r\n\r\n    # Print the results\r\n\r\n    print(f\"\\nReadability Scores Summary for {content_type.capitalize()} Content:\")\r\n\r\n    display(df)\r\n\r\n    print(f\"The probability of the content going viral is: {viral_probability * 100:.2f}%\")\r\n\r\n\r\n\r\n# Example 1: Scientific content\r\n\r\ntest_content_analysis(\r\n\r\n    'scientific',\r\n\r\n    \"Implement an accessibility-first approach in the design of the website. This includes: \u2022 High-contrast visuals for low-vision users. \u2022 Text-to-speech functionality for all text, including product descriptions and checkout processes.\u2022 Easy keyboard navigation for those unable to use a mouse.\"\r\n\r\n)\r\n\r\n\r\n\r\n# Example 2: Blog content\r\n\r\ntest_content_analysis(\r\n\r\n    'blog',\r\n\r\n    \"Today's blog post discusses the importance of user experience design. A good design ensures that users find joy and satisfaction in the interaction with the product, making it an essential aspect of product development.\"\r\n\r\n)\r\n\r\n\r\n\r\n# Example 3: Technical content\r\n\r\ntest_content_analysis(\r\n\r\n    'technical',\r\n\r\n    \"The module utilizes an advanced algorithm for data processing, ensuring high performance and reliability. It's optimized for multi-threaded environments, offering significant improvements in processing speed and efficiency.\"\r\n\r\n)\r\n\r\n\r\n\r\n# Example 4: Fictional content\r\n\r\ntest_content_analysis(\r\n\r\n    'fictional',\r\n\r\n    \"In the distant future, humanity has reached the stars. Each galaxy is a new frontier, and every planet a new adventure. Join our heroes as they navigate through cosmic dangers and discover the mysteries of the universe.\"\r\n\r\n)\r\n\r\n\r\n\r\n# Example 5: Legal content\r\n\r\ntest_content_analysis(\r\n\r\n    'legal',\r\n\r\n    \"The contract stipulates the terms and conditions of the agreement and is legally binding to both parties involved. It outlines the responsibilities, duties, and liabilities in clear, unambiguous language to prevent any misunderstandings.\"\r\n\r\n)\r\n\r\n\r\n\r\n# Example 6: Educational content\r\n\r\ntest_content_analysis(\r\n\r\n    'educational',\r\n\r\n    \"Today's lesson covers the fundamental principles of physics. We'll explore Newton's laws of motion, the concept of gravity, and the principles of energy and momentum. Each concept will be demonstrated with real-life examples and interactive experiments.\"\r\n\r\n)\r\n\r\n\r\n\r\n# Example 7: News content\r\n\r\ntest_content_analysis(\r\n\r\n    'news',\r\n\r\n    \"In today's news, the local community is coming together to support the annual food drive. Last year's drive helped over a thousand families, and this year the organizers hope to double that number with the help of generous donations and volunteer work.\"\r\n\r\n)\r\n\r\n\r\n\r\n# Example 8: Advertising content\r\n\r\ntest_content_analysis(\r\n\r\n    'advertising',\r\n\r\n    \"Introducing the latest innovation in home cleaning! Our new vacuum cleaner is equipped with advanced technology to clean your home efficiently and effortlessly. Say goodbye to dust and hello to spotless floors!\"\r\n\r\n)\r\n\r\n\r\n\r\n# Example 9: Social Media content\r\n\r\ntest_content_analysis(\r\n\r\n    'social_media',\r\n\r\n    \"Just finished an amazing workout at the gym! \ud83d\udcaa Feeling energized and ready to take on the day. Remember, a healthy lifestyle is not just a goal, it's a way of living. #FitnessGoals #HealthyLiving\"\r\n\r\n)\r\n\r\n\r\n\r\n# Example 10: Video content\r\n\r\ntest_content_analysis(\r\n\r\n    'video',\r\n\r\n    \"In this video, we'll take a closer look at the intricate ecosystem of the Amazon rainforest. Discover the diverse species that call it home, and learn about the critical role it plays in our planet's climate system.\"\r\n\r\n)\r\n\r\n```\r\n\r\n![Sample Image](https://github.com/bhaskatripathi/pyviralcontent/blob/main/Sample.JPG?raw=true)\r\n\r\n\r\n\r\n\r\n\r\n## Features\r\n\r\n\r\n\r\n- Multiple readability tests for different content types.\r\n\r\n- Qualitative descriptors based on the Likert scale.\r\n\r\n- Estimation of content's virality potential.\r\n\r\n- Supported content types include: scientific, blog, video, technical, fictional, legal, educational, news, advertising, social_media.\r\n\r\n\r\n\r\n## How it Works?\r\n\r\n\r\n\r\nThe `PyViralContent` package offers a sophisticated approach to analyzing textual content by recognizing that no single readability metric is representative fits all content types. This is essential a Multi Criteria Decision Analysis Problem which is solved using Keener's method. Different types of content have unique stylistic and structural characteristics, and the package addresses this by associating specific readability formulas with each content type. This method ensures a nuanced analysis and provides a more accurate reflection of the content's readability and potential virality.\r\n\r\n\r\n\r\n### Content Type Formulas\r\n\r\n\r\n\r\nThe package defines `content_type_formulas`, a mapping of content types to the sets of readability formulas that are best suited for those types. Here's the association between content types and their corresponding readability formulas. These formulae have been integrated using Keener's MCDA method. Keener's method computes the eigenvector corresponding to the largest eigenvalue of a certain matrix derived from the pairwise comparisons. This eigenvector provides the weights or ratings of the items being compared, reflecting their relative importance or dominance in the context of the comparison.\r\n\r\n![UML](https://github.com/bhaskatripathi/pyviralcontent/blob/main/UML.png)\r\n\r\nFor a detailed explanation of Keener's method and its applications, please refer to the following resource:\r\n\r\n[Understanding Keener's Method (PDF)](https://www.dcs.bbk.ac.uk/~ale/dsta+dsat/dsta+dsat-3/lm-ch3-keener.pdf)\r\n\r\n\r\n\r\nThe `PyViralContent` package integrates Keener's method in its analytical engine to enhance the robustness and depth of the content analysis, offering users a sophisticated tool for assessing the potential impact and reach of their content.\r\n\r\n\r\n\r\n| Content Type  | Readability Formulas Used               |\r\n\r\n|---------------|-----------------------------------------|\r\n\r\n| Scientific    | Gunning Fog, Coleman Liau, ARI          |\r\n\r\n| Blog          | Flesch Reading Ease, Flesch Kincaid     |\r\n\r\n| Video         | SMOG, Flesch Reading Ease               |\r\n\r\n| Technical     | Linsear Write, ARI                      |\r\n\r\n| Fictional     | Flesch Kincaid, Coleman Liau            |\r\n\r\n| Legal         | Gunning Fog, SMOG                       |\r\n\r\n| Educational   | Flesch Kincaid, Linsear Write           |\r\n\r\n| News          | Flesch Reading Ease, Gunning Fog        |\r\n\r\n| Advertising   | Flesch Reading Ease, Coleman Liau       |\r\n\r\n| Social Media  | Flesch Reading Ease, Linsear Write      |\r\n\r\n\r\n\r\n### Interpretation with Likert Scale\r\n\r\n\r\n\r\nThe results from the readability formulas are interpreted using a Likert scale, which provides a qualitative measure of the content's readability. This scale is not one-size-fits-all; it is tailored to each readability formula to accurately reflect the nuances of each metric. Here's how the Likert scale is applied for each readability formula:\r\n\r\n\r\n\r\n| Readability Formula     | Likert Scale Interpretation (Score Range)  | Qualitative Descriptor     |\r\n\r\n|-------------------------|--------------------------------------------|----------------------------|\r\n\r\n| Flesch Reading Ease     | 90-inf: 5, 70-90: 4, 50-70: 3, 30-50: 2, 0-30: 1 | Very Easy to Very Confusing |\r\n\r\n| Flesch Kincaid          | <=5: 5, 5-6: 4, 6-7: 3, 7-9: 2, >=9: 1     | Very Easy to Very Confusing |\r\n\r\n| Gunning Fog             | <=6: 5, 6-8: 4, 8-12: 3, 12-17: 2, >=17: 1 | Very Easy to Very Confusing |\r\n\r\n| SMOG                    | <=6: 5, 6-8: 4, 8-12: 3, 12-14: 2, >=14: 1 | Very Easy to Very Confusing |\r\n\r\n| Linsear Write           | <=5: 5, 5-8: 4, 8-12: 3, 12-15: 2, >=15: 1 | Very Easy to Very Confusing |\r\n\r\n| Coleman Liau            | <=5: 5, 5-8: 4, 8-12: 3, 12-15: 2, >=15: 1 | Very Easy to Very Confusing |\r\n\r\n| ARI                     | <=2: 5, 2-4: 4, 4-7: 3, 7-10: 2, >=10: 1   | Very Easy to Very Confusing |\r\n\r\n\r\n\r\nThese ranges and descriptors ensure that the readability score is not just a number, but a meaningful indicator of how the content will likely be received by the intended audience. The `PyViralContent` package provides a detailed output, including both the readability scores from each formula used and the overall virality probability, offering valuable insights into the potential reach and impact of the content analyzed.\r\n\r\n\r\n\r\n\r\n\r\n## Contributing\r\n\r\n\r\n\r\nContributions to `pyviralcontent` are welcome! Please feel free to submit issues, fork the repository, and create pull requests.\r\n\r\n\r\n\r\n## License\r\n\r\n\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n\r\n\r\n\r\n## Contact\r\n\r\n\r\n\r\nBhaskar Tripathi - bhaskar.tripathi@gmail.com\r\n\r\nGitHub: https://github.com/bhaskatripathi/pyviralcontent\r\n\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A package for analyzing content readability and virality potential.",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/bhaskatripathi/pyviralcontent"
    },
    "split_keywords": [
        "readability",
        "virality",
        "content-analysis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "71df2b239cf3b0d602510682d5b7d40d176a4cb1290abfe409fbb46ff9f671c1",
                "md5": "b340590999cc4e0f9a122657e7015d84",
                "sha256": "65330e11dfc40d5577b4ca8686294be22a99769f8144059229c4ece9be4b59ec"
            },
            "downloads": -1,
            "filename": "pyviralcontent-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b340590999cc4e0f9a122657e7015d84",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11082,
            "upload_time": "2024-01-23T17:13:41",
            "upload_time_iso_8601": "2024-01-23T17:13:41.553140Z",
            "url": "https://files.pythonhosted.org/packages/71/df/2b239cf3b0d602510682d5b7d40d176a4cb1290abfe409fbb46ff9f671c1/pyviralcontent-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d653785bd34ac1fa6627992ec3e62ccd8d97374eb3c4bad3c98ff131fbec58ff",
                "md5": "295baafa8e0292574cdeee7adf644f24",
                "sha256": "28c01c97c591c6bb74dfbddd6ba9bfa4f02e252e730ede9185cee55e036a5897"
            },
            "downloads": -1,
            "filename": "pyviralcontent-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "295baafa8e0292574cdeee7adf644f24",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13376,
            "upload_time": "2024-01-23T17:13:42",
            "upload_time_iso_8601": "2024-01-23T17:13:42.833135Z",
            "url": "https://files.pythonhosted.org/packages/d6/53/785bd34ac1fa6627992ec3e62ccd8d97374eb3c4bad3c98ff131fbec58ff/pyviralcontent-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-23 17:13:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bhaskatripathi",
    "github_project": "pyviralcontent",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyviralcontent"
}
        
Elapsed time: 0.33742s