modernmt: Add to local ModernMT works, but update does not

All translations are added to memory id 1.

public function addToMemoryContent($source, $target, $sentence, $translation) { return $this->send('POST', "$this->baseUrl/memories/1/corpus", [ 'source' => $source, 'target' => $target, 'sentence' => $sentence, 'translation' => $translation ]); }

Works. I can attest the data is actually added to the memory, as I see the network has learnt from the suggestions in later sentences.

However

public function updateMemoryContent($source, $target, $sentence, $translation, $oldSentence, $oldTranslation) { return $this->send('PUT', "$this->baseUrl/memories/1/content", [ 'source' => $source, 'target' => $target, 'sentence' => $sentence, 'translation' => $translation, 'old_sentence' => $oldSentence, 'old_translation' => $oldTranslation ]); // } }

…gives Invalid API endpoint.

Now if I go manually to $this->baseUrl/memories/1, I get a neat response. If I go to $this->baseUrl/memories/1/corpus, I get invalid API endpoint (even though addToMemoryContent seems to have no issues with this). If I go to $this->baseUrl/memories/1/content, I once again get invalid API endpoint, but that was to be expected considering the results above.

What’s going on here? Does Update not work on local networks?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

Is there any way we can test said end point on Ubuntu itself?

Sure, just run:

curl -X PUT http://localhost:8045/memories/1/corpus \
     -d "source=en" \
     -d "target=nl" \
     -d "sentence=Hello world" \
     -d "translation=Hallo Wereld" \
     -d "old_sentence=Hello world" \
     -d "old_translation=Hllo Wereld" \
     | python -mjson.tool