示例#1
0
def test_count_stuff():

    """
    Tests that the top function-flow combination for the component "screw" is "couple solid"
    """

    script_dir = os.path.dirname(__file__)
    file1 = os.path.join(script_dir, '../assets/bladeCombined.csv')

    comb_sort = count_stuff(file1)

    assert comb_sort['screw'][0][0] == 'couple solid'
示例#2
0
def test_get_top_results():

    """
    Tests that the top 70% of function-flow combinations for the component "screw" only has one result
    """

    script_dir = os.path.dirname(__file__)
    file2 = os.path.join(script_dir, '../assets/bladeCombined.csv')

    comb_sort = count_stuff(file2)

    threshold = 0.7
    thresh_results = get_top_results(comb_sort, threshold)

    assert len(thresh_results['screw']) == 1
def test_1():
    """ Example showing how to automate result finding with probability values  """

    # Dataset used for data mining
    script_dir = os.path.dirname(__file__)
    file1 = os.path.join(script_dir, '../assets/bladeCombined.csv')

    comb_sort = count_stuff(file1)

    # Use a threshold to get the top XX% of confidence values
    threshold = 0.5
    thresh_results = get_top_results(comb_sort, threshold)

    # Use a known product for verification
    input_file = os.path.join(script_dir, '../assets/InputExample.csv')

    # Get dictionary of functions and flows for each component based on data mining
    results, unmatched = get_func_rep(thresh_results, input_file, True)

    assert results['screw'][0][0] == 'couple solid'
    assert 'cheese' in unmatched
示例#4
0
from autofunc.simple_counter import count_stuff
from autofunc.get_func_rep import get_func_rep
from autofunc.get_top_results import get_top_results
from autofunc.write_results import write_results_from_dict
import os.path
""" Example showing how to automate functional representation using simple counting  """

# Dataset used for data mining
script_dir = os.path.dirname(__file__)
file1 = os.path.join(script_dir, '../assets/bladeCombined.csv')

comb_sort = count_stuff(file1)

# Use a threshold to get the top XX% of confidence values
threshold = 0.5
thresh_results = get_top_results(comb_sort, threshold)

# Use a known product for verification
input_file = os.path.join(script_dir, '../assets/InputExample.csv')

# Get dictionary of functions and flows for each component based on data mining
results, unmatched = get_func_rep(thresh_results, input_file, True)

# Optional write to file - uncomment and rename to write file
write_results_from_dict(results, 'test1.csv')