Пример #1
0
import subprocess
import sys

from pyserini.util import download_evaluation_script

script_path = download_evaluation_script('msmarco_doc_eval')
cmd_prefix = ['python3', script_path]
args = sys.argv
cmd = cmd_prefix + args[1:] if len(args) > 1 else cmd_prefix
print(f'Running command: {cmd}')
process = subprocess.Popen(cmd,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
if stderr:
    print('Results:')
    print(stderr.decode("utf-8"))
else:
    print(stdout.decode("utf-8"))
Пример #2
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import os
import subprocess
import sys
import platform

from pyserini.search import get_qrels_file
from pyserini.util import download_evaluation_script

script_path = download_evaluation_script('trec_eval')
cmd_prefix = ['java', '-jar', script_path]
args = sys.argv
if len(args) > 1:
    cmd = cmd_prefix + args[1:]
    if not os.path.exists(cmd[-2]):
        cmd[-2] = get_qrels_file(cmd[-2])
else:
    cmd = cmd_prefix
print(f'Running command: {cmd}')
shell = platform.system() == "Windows"
process = subprocess.Popen(cmd,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE,
                           shell=shell)
stdout, stderr = process.communicate()
Пример #3
0
import os
import subprocess
import sys
import platform

from pyserini.search import get_qrels_file
from pyserini.util import download_evaluation_script

script_path = download_evaluation_script('msmarco_passage_eval')
cmd_prefix = ['python', script_path]
args = sys.argv
if len(args) > 1:
    cmd = cmd_prefix + args[1:]
    if not os.path.exists(cmd[-2]):
        cmd[-2] = get_qrels_file(cmd[-2])
else:
    cmd = cmd_prefix
print(f'Running command: {cmd}')
shell = platform.system() == "Windows"
process = subprocess.Popen(cmd,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE,
                           shell=shell)
stdout, stderr = process.communicate()
if stderr:
    print(stderr.decode("utf-8"))
print('Results:')
print(stdout.decode("utf-8"))