Skip to content

Dockerfile #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions DatasetCollection/datacollection_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import requests
from bs4 import BeautifulSoup

def get_table_data(table_data, html_content):
soup = BeautifulSoup(html_content, "html.parser")
tables = soup.find_all('table', class_='searchResultsTable')

for table in tables:
expression_data = {}

# Extract expression, description, matches, and non-matches
expression_data['id'] = len(table_data) + 1
details_link = table.find('a', class_='buttonSmall', href=True)
if details_link:
expression_data['details_link'] = "https://regexlib.com/"+details_link['href'].replace('RETester.aspx', 'REDetails.aspx')
expression_data['expression'] = table.find('tr', class_='expression').find('div', class_='expressionDiv').text.strip()
expression_data['description'] = table.find('tr', class_='description').find('div', class_='overflowFixDiv').text.strip()
expression_data['matches'] = table.find('tr', class_='matches').find('div', class_='overflowFixDiv').text.strip()
expression_data['non_matches'] = table.find('tr', class_='nonmatches').find('div', class_='overflowFixDiv').text.strip()

# Append data to the list
table_data.append(expression_data)

return table_data

table_data = []

for i in range(1, 43):
url = "https://regexlib.com/Search.aspx?k=&c=-1&m=-1&ps=100&p=" + str(i)
response = requests.get(url)
if response.status_code == 200:
html_content = response.text
table_data = get_table_data(table_data, html_content)
print(len(table_data))
print(table_data[-1])
else:
print(f"Failed to fetch data for page {i}")

# Save data to JSON file
import json
with open('./test.json', 'w') as f:
json.dump(table_data, f)
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use the continuumio/anaconda3 base image
FROM continuumio/anaconda3

# Set the working directory inside the container
WORKDIR /app

# Copy the contents of the ReDos_Benchmarking directory into the container at /app
COPY ReDos_Benchmarking /app

# Install dependencies
RUN pip install datasets && \
#conda install -c huggingface -c conda-forge datasets && \
pip install tqdm && \
apt-get update && \
apt-get -y install gcc mono-mcs python3-dev

# Specify the command to run on container start
CMD ["python", "-c", "from datasets import load_dataset"]
18 changes: 18 additions & 0 deletions RegexEvalDocker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use the continuumio/anaconda3 base image
FROM continuumio/anaconda3

# Set the working directory inside the container
WORKDIR /app

# Copy the contents of the ReDos_Benchmarking directory into the container at /app
COPY ReDos_Benchmarking /app

# Install dependencies
RUN pip install datasets && \
#conda install -c huggingface -c conda-forge datasets && \
pip install tqdm && \
apt-get update && \
apt-get -y install gcc mono-mcs python3-dev

# Specify the command to run on container start
CMD ["python", "-c", "from datasets import load_dataset"]
42 changes: 42 additions & 0 deletions RegexEvalDocker/datacollection_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import requests
from bs4 import BeautifulSoup

def get_table_data(table_data, html_content):
soup = BeautifulSoup(html_content, "html.parser")
tables = soup.find_all('table', class_='searchResultsTable')

for table in tables:
expression_data = {}

# Extract expression, description, matches, and non-matches
expression_data['id'] = len(table_data) + 1
details_link = table.find('a', class_='buttonSmall', href=True)
if details_link:
expression_data['details_link'] = "https://regexlib.com/"+details_link['href'].replace('RETester.aspx', 'REDetails.aspx')
expression_data['expression'] = table.find('tr', class_='expression').find('div', class_='expressionDiv').text.strip()
expression_data['description'] = table.find('tr', class_='description').find('div', class_='overflowFixDiv').text.strip()
expression_data['matches'] = table.find('tr', class_='matches').find('div', class_='overflowFixDiv').text.strip()
expression_data['non_matches'] = table.find('tr', class_='nonmatches').find('div', class_='overflowFixDiv').text.strip()

# Append data to the list
table_data.append(expression_data)

return table_data

table_data = []

for i in range(1, 43):
url = "https://regexlib.com/Search.aspx?k=&c=-1&m=-1&ps=100&p=" + str(i)
response = requests.get(url)
if response.status_code == 200:
html_content = response.text
table_data = get_table_data(table_data, html_content)
print(len(table_data))
print(table_data[-1])
else:
print(f"Failed to fetch data for page {i}")

# Save data to JSON file
import json
with open('./test.json', 'w') as f:
json.dump(table_data, f)
1 change: 1 addition & 0 deletions RegexEvalDocker/test.json

Large diffs are not rendered by default.