<jupyter_start><jupyter_text>**MapMatching4GMNS**MapMatching4GMNS is an open-source, cross-platform, lightweight, and fast PythonMapMatching engine for maping GPS traces to the underlying network using GeneralModeling Network Specification encoded in [GMNS]. Its most likely pathfinding algorithm takes about 0.02 seconds to process one GPS trace with 50location points in a large-scale network with 10K nodes. Based on input networkand given GPS trajectory data, the map-matching program aims to find most likelyroute in terms of node sequence in the underlying network.<jupyter_code>#"Clone the Github repository"
!git clone https://github.com/asu-trans-ai-lab/MapMatching4GMNS<jupyter_output>fatal: destination path 'MapMatching4GMNS' already exists and is not an empty directory.<jupyter_text>1. MapMatching4GMNS modeling<jupyter_code># """install MapMatching4GMNS"""
!pip install MapMatching4GMNS --upgrade
import time
'''
To avoid complex data folder settings, please always first put the input data on the current directory.
Once the package is imported, agent.csv can be generated.
'''
start = time.time() 
# """Once the package is imported, agent.csv can be generated"""\
import MapMatching4GMNS as mmg
end = time.time()
print('time cost: %.6f'%(end-start))<jupyter_output>To avoid complex data folder settings, please always first put the input data on the current directory.
call MapMatching4GMNS  dynamic library
MapMatching4GMNS time cost: 6.470405 seconds
The output data agent.csv is generated!
time cost: 6.474364<jupyter_text>if you use google.colab, you can donwload result data<jupyter_code>#from google.colab import files
#files.download("/content/agent.csv")<jupyter_output><empty_output><jupyter_text>2. Directly call the MapMatching4GMNS's dynamic library<jupyter_code>import ctypes
import collections
import heapq
import os.path
from sys import platform
import time
os.path.exists("agent.csv")
os.remove("agent.csv")<jupyter_output><empty_output><jupyter_text>Mode 2: shortest paths for all agents (to be tested as a change of function names in the recent release).<jupyter_code>if platform.startswith('win32'):
    _dll_file =  './bin/MapMatching4GMNS.dll'
elif platform.startswith('linux'):
    _dll_file = './bin/MapMatching4GMNS.so'
elif platform.startswith('darwin'):
    _dll_file =  './bin/MapMatching4GMNS.dylib'
else:
    raise Exception('Please build the shared library compatible to your OS\
                    using source files in engine_cpp!')

_cdll = ctypes.cdll.LoadLibrary(_dll_file)
start = time.time() 
agent_compu = _cdll.MapMatching4GMNS
agent_compu.restype = ctypes.c_double
agent = agent_compu()
print('MapMatching4GMNS')
end = time.time()
print('MapMatching4GMNS time cost: %.6f seconds' % (end-start))
print("The output data agent.csv is generated!")<jupyter_output>MapMatching4GMNS
MapMatching4GMNS time cost: 9.646537 seconds
The output data agent.csv is generated!<jupyter_text>if you use google.colab, you can donwload result data<jupyter_code>#from google.colab import files
#files.download("/content/agent.csv")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08908973531310523, 'fraction_numerical': 0.017430600387346677, 'mean_word_length': 5.948430493273543, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '637255', 'license': 'Apache-2.0', 'n_tokens_mistral': 986, 'n_tokens_neox': 950, 'n_words': 308, 'path': 'MapMatching4GMNS.ipynb', 'repo_name': 'xiaomo123zk/MapMatching4GMNS-v0.2.2-master', 'size': '3098'}