New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discriminates phdthesis and mastersthesis BibTeX types. #941

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@cgranade

cgranade commented Sep 1, 2015

This PR discriminates between the @phdthesis and @mastersthesis BibTeX types using the type field of Zotero items of type thesis. See https://forums.zotero.org/discussion/6276/support-for-masters-thesis-type-and-full-bibtex-format/ for a discussion of the pros and cons to this approach.

cgranade added some commits Sep 1, 2015

Minor fix to prev commit to suppress type when needed
If the BibTeX type carries all relevant information, then the Zotero
field "Type" is redundant and should be suppressed.
// In practice, we just want to separate out masters theses,
// and will assume everything else maps to @phdthesis. Better to
// err on the side of caution.
if (item["type"] && item["type"].toLowerCase() == "masters") {

This comment has been minimized.

@adam3smith

adam3smith Sep 1, 2015

Collaborator

I think we can be a little more generous here, no? I'm thinking .indexOf("master")!=-1
@karnesky -- any objections here?

@adam3smith

adam3smith Sep 1, 2015

Collaborator

I think we can be a little more generous here, no? I'm thinking .indexOf("master")!=-1
@karnesky -- any objections here?

This comment has been minimized.

@aurimasv

aurimasv Sep 1, 2015

Contributor

I wouldn't go that far, but maybe something like

var thesisType = item.type && item.type.toLowerCase().replace(/[\s.]+|thesis/g, '');
if (thesisType &&  (thesisType == 'master' || thesisType == 'masters' || thesisType == 'ms')) {
@aurimasv

aurimasv Sep 1, 2015

Contributor

I wouldn't go that far, but maybe something like

var thesisType = item.type && item.type.toLowerCase().replace(/[\s.]+|thesis/g, '');
if (thesisType &&  (thesisType == 'master' || thesisType == 'masters' || thesisType == 'ms')) {

This comment has been minimized.

@adam3smith

adam3smith Sep 1, 2015

Collaborator

we'd also want "Master's" covered; also MA and MSc are frequently used. May want to test for those in uppercase, though, to be safer.
What's the objection to testing against just "master"? (and then also common abbreviations) I can't really see a case where that wouldn't be a master's thesis.

@adam3smith

adam3smith Sep 1, 2015

Collaborator

we'd also want "Master's" covered; also MA and MSc are frequently used. May want to test for those in uppercase, though, to be safer.
What's the objection to testing against just "master"? (and then also common abbreviations) I can't really see a case where that wouldn't be a master's thesis.

This comment has been minimized.

@aurimasv

aurimasv Sep 1, 2015

Contributor

I'd rather test for something specific, that's all. Much more predictable behavior. We can easily cover what you suggested above.

@aurimasv

aurimasv Sep 1, 2015

Contributor

I'd rather test for something specific, that's all. Much more predictable behavior. We can easily cover what you suggested above.

This comment has been minimized.

@karnesky

karnesky Sep 1, 2015

Contributor

This looks good to me too. If we're going to be very specific, we should ensure BibTeX imports gets the proper item.type populated by whatever we're trying to prescribe.

I have no idea what people tend to use for the "Type" field in Zotero. Is there a way to survey usage to make sure that whatever pattern we select is both sane and comprehensive?

@karnesky

karnesky Sep 1, 2015

Contributor

This looks good to me too. If we're going to be very specific, we should ensure BibTeX imports gets the proper item.type populated by whatever we're trying to prescribe.

I have no idea what people tend to use for the "Type" field in Zotero. Is there a way to survey usage to make sure that whatever pattern we select is both sane and comprehensive?

This comment has been minimized.

@cgranade

cgranade Sep 1, 2015

One way to survey might be to check what existing translators do on common
thesis repositories, such as those based on MIT's dspace.

On Wed, Sep 2, 2015, 09:17 Richard Karnesky notifications@github.com
wrote:

In BibTeX.js
#941 (comment):

@@ -1173,6 +1173,20 @@ function doExport() {
// determine type
var type = zotero2bibtexTypeMap[item.itemType];
if (typeof(type) == "function") { type = type(item); }
+

  •   // The thesis Zotero type doesn't nicely map onto a BibTeX type,
    
  •   // as BibTeX uses both @mastersthesis and @phdthesis. We thus have
    
  •   // to tell them apart by the "Type" field as well as by the item type.
    
  •   if (type == "phdthesis") {
    
  •       // In practice, we just want to separate out masters theses,
    
  •       // and will assume everything else maps to @phdthesis. Better to
    
  •       // err on the side of caution.
    
  •       if (item["type"] && item["type"].toLowerCase() == "masters") {
    

This looks good to me too. If we're going to be very specific, we should
ensure BibTeX imports gets the proper item.type populated by whatever we're
trying to prescribe.

I have no idea what people tend to use for the "Type" field in Zotero. Is
there a way to survey usage to make sure that whatever pattern we select is
both sane and comprehensive?


Reply to this email directly or view it on GitHub
https://github.com/zotero/translators/pull/941/files#r38483908.

@cgranade

cgranade Sep 1, 2015

One way to survey might be to check what existing translators do on common
thesis repositories, such as those based on MIT's dspace.

On Wed, Sep 2, 2015, 09:17 Richard Karnesky notifications@github.com
wrote:

In BibTeX.js
#941 (comment):

@@ -1173,6 +1173,20 @@ function doExport() {
// determine type
var type = zotero2bibtexTypeMap[item.itemType];
if (typeof(type) == "function") { type = type(item); }
+

  •   // The thesis Zotero type doesn't nicely map onto a BibTeX type,
    
  •   // as BibTeX uses both @mastersthesis and @phdthesis. We thus have
    
  •   // to tell them apart by the "Type" field as well as by the item type.
    
  •   if (type == "phdthesis") {
    
  •       // In practice, we just want to separate out masters theses,
    
  •       // and will assume everything else maps to @phdthesis. Better to
    
  •       // err on the side of caution.
    
  •       if (item["type"] && item["type"].toLowerCase() == "masters") {
    

This looks good to me too. If we're going to be very specific, we should
ensure BibTeX imports gets the proper item.type populated by whatever we're
trying to prescribe.

I have no idea what people tend to use for the "Type" field in Zotero. Is
there a way to survey usage to make sure that whatever pattern we select is
both sane and comprehensive?


Reply to this email directly or view it on GitHub
https://github.com/zotero/translators/pull/941/files#r38483908.

This comment has been minimized.

@aurimasv

aurimasv Jan 18, 2016

Contributor

Existing behavior probably varies quite a lot, so I wouldn't consider it. We could ask @dstillman to run a query on the synced user data for that field and give us a list of top N results. I'm sure he's busy with other things though, so let's just go with best effort.

@aurimasv

aurimasv Jan 18, 2016

Contributor

Existing behavior probably varies quite a lot, so I wouldn't consider it. We could ask @dstillman to run a query on the synced user data for that field and give us a list of top N results. I'm sure he's busy with other things though, so let's just go with best effort.

@adam3smith

This comment has been minimized.

Show comment
Hide comment
@adam3smith

adam3smith Jan 1, 2018

Collaborator

closed in 71a55e8
thanks!

Collaborator

adam3smith commented Jan 1, 2018

closed in 71a55e8
thanks!

@adam3smith adam3smith closed this Jan 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment