<jupyter_start><jupyter_text>Get static file> get none-python file, like js and html<jupyter_code># default_exp static_file
# export
from pathlib import Path 
def get_static()->Path: 
    """
    return the absolute path of forgebox.static
    """
    import forgebox 
    return Path(forgebox.__path__[0])/"static" 

def open_static(relative_path:str)->str:
    file = get_static()/relative_path
    with open(file,"r") as f:
        return f.read()<jupyter_output><empty_output><jupyter_text>The static file directory<jupyter_code>get_static()<jupyter_output><empty_output><jupyter_text>Open relative path<jupyter_code>open_static("mlm/visual.html")
print(open_static("mlm/visual.js")[:500])<jupyter_output>var mlm_visualize = (data, text, output_id) => {
    var {
        Sentence,
        ControlBar,
        att_obj
    } = attention_factory(data, text, output_id)

    var sentence = new Sentence();
    var control_bar = new ControlBar({
        nb_heads: att_obj.attention.length,
        current_head: 0
    });

    control_bar.sensitive.add_callback(
        control_bar.func_print_change,
        control_bar.change_current_head(att_obj),
    )

    $(`#${output_id}`).append(control_bar.dom)
{'fraction_non_alphanumeric': 0.11784232365145228, 'fraction_numerical': 0.004149377593360996, 'mean_word_length': 4.067226890756302, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '427459', 'license': 'MIT', 'n_tokens_mistral': 427, 'n_tokens_neox': 410, 'n_words': 72, 'path': 'nbs/12_static_file.ipynb', 'repo_name': 'raynardj/forgebox', 'size': '1205'}