https://github.com/capjamesg/pattern-matching

Find patterns in strings.

https://github.com/capjamesg/pattern-matching

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.2%) to scientific vocabulary

Keywords

pattern-finding python string-pattern-identification
Last synced: 6 months ago · JSON representation

Repository

Find patterns in strings.

Basic Info
  • Host: GitHub
  • Owner: capjamesg
  • License: mit
  • Language: HTML
  • Default Branch: main
  • Homepage:
  • Size: 27.3 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
pattern-finding python string-pattern-identification
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

Pattern Matching

Find a pattern that matches a string.

This project can take a list of strings and find common patterns of words. For example, given the titles:

This is a test This is a coffee This is a tea

This project would return:

This is a *

Where * denotes the presence of any word.

Or, given:

This is a test This isn't a test This is of course a test

The script will return:

This * a test

This project was designed to find patterns in URL slugs.

How to Use

To use this project, first clone this repository. Then, create a new Python file and add the code below:

```python from .patterns import getpatterns, calculatematchesfromexamples

urls = [] topcandidate = max(getpatterns(delimiter = "-").values(), key=len) matches, _ = calculatematchesfromexamples(topcandidate, urls, delimiter = "-")

print("# of examples: ", len(examples)) print(f"Pattern: {top_candidate}") print(f"Match rate: {(matches / len(examples)) * 100:.2f}%")

# of examples: 50

Pattern: ['', 'and', '']

Match rate: 74.00%

```

Add a value for urls, then run the code. You can use any sequence of strings where there is a delimiter. If you use plain text, the delimiter should be a space.

License

This project is licensed under an MIT license.

Owner

  • Name: James
  • Login: capjamesg
  • Kind: user
  • Location: Scotland
  • Company: @Roboflow

from words, wonder.

GitHub Events

Total
  • Watch event: 1
  • Push event: 12
  • Create event: 2
Last Year
  • Watch event: 1
  • Push event: 12
  • Create event: 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels